diff --git a/base.py b/base.py index 779a7d4..80226e9 100644 --- a/base.py +++ b/base.py @@ -487,12 +487,20 @@ class ServiceManager: print(str(e)) def do_help(self, *args): + options = {'ins': ' ', 'optional_ins': '[instance] ', 'remark': '*', 'legend': ''} + wildcards = True if self.main_ins: - usage = self.USAGE.replace('', '[instance]') % ( - '[instance] is empty or one of %s' % ', '.join(self.info)) + if len(self.info) == 1: + for key in options: + options[key] = '' + wildcards = False + else: + options['legend'] = ' [instance] is empty or one of %s\n' % ', '.join(self.info) else: - usage = self.USAGE % (' is one of %s' % ', '.join(self.info)) - print(usage) + options['legend'] = ' is one of %s' % ', '.join(self.info) + if wildcards: + options['legend'] += " * wildcards allowed, using '.' to replace 0 or more arbitrary characters in \n" + print(self.USAGE % options) def treat_args(self, argdict, unknown=(), extra=()): if unknown: diff --git a/frappyman.py b/frappyman.py index 99f1f96..39cf200 100644 --- a/frappyman.py +++ b/frappyman.py @@ -175,15 +175,14 @@ class FrappyManager(ServiceManager): USAGE = """ Usage: - frappy list [instance] * - frappy start - frappy restart [] [] * - frappy stop [] * - frappy listcfg [ | develop] # list available cfg files + frappy list %(optional_ins)s + frappy start %(ins)s + frappy restart %(ins)s[] [] %(remark)s + frappy stop %(ins)s[] %(remark)s + frappy listcfg %(ins)s[ | develop] # list available cfg files is one of main, stick, addons - %s - * wildcards allowed, using '.' to replace 0 or more arbitrary characters in +%(legend)s """ def config_dirs(self, ins, service): diff --git a/nicosman.py b/nicosman.py index f984a78..f5672d2 100644 --- a/nicosman.py +++ b/nicosman.py @@ -56,7 +56,7 @@ class NicosManager(ServiceManager): nicos gui nicos (the same as above) - nicos list [] * + nicos list [] nicos start [] * nicos restart [] * nicos stop [] * diff --git a/seaman.py b/seaman.py index 268375e..96addb9 100644 --- a/seaman.py +++ b/seaman.py @@ -56,17 +56,16 @@ class SeaManager(ServiceManager): USAGE = """ Usage: - sea gui - sea # the same as sea gui - sea cli # the same as old seacmd - sea start [service] * # the same as old 'monit start sea' - sea restart [service] * - sea stop [service] * - sea list [instance] * + sea gui %(ins)s + sea %(ins)s # the same as sea gui + sea cli %(ins)s # the same as old seacmd + sea start %(ins)s[service] %(remark)s # the same as old 'monit start sea' + sea restart %(ins)s[service] %(remark)s + sea stop %(ins)s[service] %(remark)s + sea list %(optional_ins)s [service] is empty or one of sea, graph - %s - * wildcards allowed, using '.' to replace 0 or more arbitrary characters in +%(legend)s """ def do_cli(self, ins):