introduce wildcards for <instance>

This commit is contained in:
2021-12-06 14:39:04 +01:00
parent bb3c72acc9
commit f411460c2c
5 changed files with 71 additions and 28 deletions

View File

@ -34,14 +34,15 @@ class FrappyManager(ServiceManager):
USAGE = """
Usage:
frappy list [<instance>]
frappy list [<instance>] *
frappy start <instance> <service> <cfgfiles>
frappy restart <instance> [<service>] [<cfgfiles>]
frappy stop <instance> [<service>]
frappy restart <instance> [<service>] [<cfgfiles>] *
frappy stop <instance> [<service>] *
frappy listcfg <instance> [<service>] # list available cfg files
<service> is one of main, stick, addons
%s
* wildcards allowed, using '.' to replace 0 or more arbitrary characters in <instance>
"""
def config_dirs(self, ins, service):
@ -70,6 +71,8 @@ class FrappyManager(ServiceManager):
return start_dir, env
def do_start(self, ins, service=None, cfg='', restart=False, wait=False, logger=None):
if self.wildcard(ins) is not None:
raise UsageError('no wildcards allowed with %s start' % self.group)
if cfg and not service and len(self.services) != 1:
raise UsageError('need service to start (one of %s)' % ', '.join(self.services))
super().do_start(ins, service, cfg, restart, wait, logger)