improve commandline argument behaviour
+ allow hprt2 / zebra2
This commit is contained in:
7
base.py
7
base.py
@ -138,7 +138,7 @@ class ServiceManager:
|
||||
for ins in parser.sections():
|
||||
section = dict(parser[ins])
|
||||
if ins == 'MAIN':
|
||||
ins = self.main_ins = basename(expanduser('~'))
|
||||
ins = self.main_ins = os.environ.get('Instrument') or basename(expanduser('~'))
|
||||
if 'REMOTE_HOST' in section:
|
||||
self.remote_hosts[ins] = section['REMOTE_HOST']
|
||||
command = section.get('%s_command' % self.group)
|
||||
@ -470,7 +470,8 @@ class ServiceManager:
|
||||
|
||||
def do_help(self, *args):
|
||||
if self.main_ins:
|
||||
usage = self.USAGE.replace(' <instance>', '').replace(' [<instance>]', '') % ''
|
||||
usage = self.USAGE.replace('<instance>', '[instance]') % (
|
||||
'[instance] is empty or one of %s' % ', '.join(self.info))
|
||||
else:
|
||||
usage = self.USAGE % ('<instance> is one of %s' % ', '.join(self.info))
|
||||
print(usage)
|
||||
@ -479,7 +480,7 @@ class ServiceManager:
|
||||
if unknown:
|
||||
raise UsageError('unknown argument: %s' % (' '.join(unknown)))
|
||||
if extra:
|
||||
return [argdict.get('ins'), argdict.get('service')] + extra
|
||||
return [argdict.get('ins'), argdict.get('service')] + list(extra)
|
||||
args = [argdict.get('ins'), argdict.get('service')]
|
||||
while args and not args[-1]:
|
||||
args.pop()
|
||||
|
Reference in New Issue
Block a user