add bold on command syntax in help
This commit is contained in:
parent
ee1728b27f
commit
bcc75c37c7
1 changed files with 9 additions and 10 deletions
|
|
@ -65,7 +65,6 @@ class ReplOptionFormatter(IndentedHelpFormatter):
|
||||||
s += '\n'
|
s += '\n'
|
||||||
s += '%s Commands:\n' % section
|
s += '%s Commands:\n' % section
|
||||||
for c in cmds:
|
for c in cmds:
|
||||||
c = c.split('\n')[0]
|
|
||||||
s += ' %s\n' % c
|
s += ' %s\n' % c
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
@ -493,15 +492,15 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
if not doc:
|
if not doc:
|
||||||
return '%s' % command
|
return '%s' % command
|
||||||
|
|
||||||
doc = '\n'.join(line.strip() for line in doc.strip().split('\n'))
|
lines = [line.strip() for line in doc.strip().split('\n')]
|
||||||
if not doc.startswith(command):
|
if not lines[0].startswith(command):
|
||||||
doc = '%s\n\n%s' % (command, doc)
|
lines = [command, '\n', '\n'] + lines
|
||||||
if short:
|
|
||||||
doc = doc.split('\n')[0]
|
|
||||||
if not doc.startswith(command):
|
|
||||||
doc = command
|
|
||||||
|
|
||||||
return doc
|
if short:
|
||||||
|
return lines[0]
|
||||||
|
|
||||||
|
lines[0] = '%s%s%s' % (self.BOLD, lines[0], self.NC)
|
||||||
|
return '\n'.join(lines)
|
||||||
|
|
||||||
def get_commands_doc(self):
|
def get_commands_doc(self):
|
||||||
names = set(name for name in self.get_names() if name.startswith('do_'))
|
names = set(name for name in self.get_names() if name.startswith('do_'))
|
||||||
|
|
@ -513,12 +512,12 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
if cmd in self.hidden_commands.union(self.weboob_commands).union(['help']):
|
if cmd in self.hidden_commands.union(self.weboob_commands).union(['help']):
|
||||||
continue
|
continue
|
||||||
elif getattr(self, name).__doc__:
|
elif getattr(self, name).__doc__:
|
||||||
d[appname].append(self.get_command_help(cmd))
|
d[appname].append(self.get_command_help(cmd, short=True))
|
||||||
else:
|
else:
|
||||||
d[appname].append(cmd)
|
d[appname].append(cmd)
|
||||||
if not self.DISABLE_REPL:
|
if not self.DISABLE_REPL:
|
||||||
for cmd in self.weboob_commands:
|
for cmd in self.weboob_commands:
|
||||||
d['Weboob'].append(self.get_command_help(cmd))
|
d['Weboob'].append(self.get_command_help(cmd, short=True))
|
||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue