From 4fb55323e336dfddd7e4fa6babd838ed8c7ec283 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Fri, 9 Apr 2021 10:28:18 +0200 Subject: [PATCH] do not show in help when not needed --- base.py | 10 +++++++--- frappyman.py | 2 +- nicosman.py | 2 +- seaman.py | 8 ++++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/base.py b/base.py index fd2e399..351d914 100644 --- a/base.py +++ b/base.py @@ -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(' ', '').replace(' []', '') % '' + else: + usage = self.USAGE % (' is one of %s' % ', '.join(self.info)) + print(usage) diff --git a/frappyman.py b/frappyman.py index 5849610..74a4312 100644 --- a/frappyman.py +++ b/frappyman.py @@ -36,7 +36,7 @@ class FrappyManager(ServiceManager): frappy stop [] is one of main, stick, addons - is one of %s + %s """ def prepare_start(self, ins, service): diff --git a/nicosman.py b/nicosman.py index 9175f00..a1dc686 100644 --- a/nicosman.py +++ b/nicosman.py @@ -65,7 +65,7 @@ class NicosManager(ServiceManager): nicos link (create links to nicos data and scripts) is one of main, stick, addons - is one of %s + %s to be done after the experiment: nicos copy (copy data and scripts from link) diff --git a/seaman.py b/seaman.py index e8c5e2a..2606f3a 100644 --- a/seaman.py +++ b/seaman.py @@ -51,15 +51,15 @@ class SeaManager(ServiceManager): Usage: sea gui - sea # the same as sea gui - sea cli (the same as old seacmd) - sea start + sea # the same as sea gui + sea cli # the same as old seacmd + sea start [] sea restart [] sea stop [] sea list [] is one of sea, graph - is one of %s + %s """ def do_cli(self, ins):