do not show <instance> in help when not needed
This commit is contained in:
10
base.py
10
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(' <instance>', '').replace(' [<instance>]', '') % ''
|
||||
else:
|
||||
usage = self.USAGE % ('<instance> is one of %s' % ', '.join(self.info))
|
||||
print(usage)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user