do not show <instance> in help when not needed

This commit is contained in:
zolliker 2021-04-09 10:28:18 +02:00
parent 3748948b5d
commit 4fb55323e3
4 changed files with 13 additions and 9 deletions

10
base.py
View File

@ -83,7 +83,7 @@ class ServiceManager:
pkg = ''
revcmd = {}
USAGE = None
main_ins = basename(expanduser('~'))
main_ins = None
def __init__(self):
self.env = {}
@ -137,7 +137,7 @@ class ServiceManager:
for ins in parser.sections():
section = dict(parser[ins])
if ins == 'MAIN':
ins = self.main_ins
ins = self.main_ins = basename(expanduser('~'))
command = section.get('%s_command' % self.group)
self.revcmd[command] = self.group
nr = section.get(self.group)
@ -410,5 +410,9 @@ class ServiceManager:
raise
def usage(self):
print(self.USAGE % ', '.join(self.info))
if self.main_ins:
usage = self.USAGE.replace(' <instance>', '').replace(' [<instance>]', '') % ''
else:
usage = self.USAGE % ('<instance> is one of %s' % ', '.join(self.info))
print(usage)

View File

@ -36,7 +36,7 @@ class FrappyManager(ServiceManager):
frappy stop <instance> [<service>]
<service> is one of main, stick, addons
<instance> is one of %s
%s
"""
def prepare_start(self, ins, service):

View File

@ -65,7 +65,7 @@ class NicosManager(ServiceManager):
nicos link <instance> (create links to nicos data and scripts)
<service> is one of main, stick, addons
<instance> is one of %s
%s
to be done after the experiment:
nicos copy (copy data and scripts from link)

View File

@ -51,15 +51,15 @@ class SeaManager(ServiceManager):
Usage:
sea gui <instance>
sea <instance> # the same as sea gui <instance>
sea cli <instance> (the same as old seacmd)
sea start <instance> <service>
sea <instance> # the same as sea gui <instance>
sea cli <instance> # the same as old seacmd
sea start <instance> [<service>]
sea restart <instance> [<service>]
sea stop <instance> [<service>]
sea list [<instance>]
<service> is one of sea, graph
<instance> is one of %s
%s
"""
def do_cli(self, ins):