[WIP] improve help message

This commit is contained in:
2024-02-23 18:01:27 +01:00
parent 0b099bab28
commit 343e607c1b
4 changed files with 27 additions and 21 deletions

16
base.py
View File

@@ -487,12 +487,20 @@ class ServiceManager:
print(str(e))
def do_help(self, *args):
options = {'ins': '<instance> ', 'optional_ins': '[instance] ', 'remark': '*', 'legend': ''}
wildcards = True
if self.main_ins:
usage = self.USAGE.replace('<instance>', '[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 % ('<instance> is one of %s' % ', '.join(self.info))
print(usage)
options['legend'] = ' <instance> is one of %s' % ', '.join(self.info)
if wildcards:
options['legend'] += " * wildcards allowed, using '.' to replace 0 or more arbitrary characters in <instance>\n"
print(self.USAGE % options)
def treat_args(self, argdict, unknown=(), extra=()):
if unknown: