display available commands in ConsoleApplication's --help
This commit is contained in:
parent
ccf4303cc0
commit
40a118283f
2 changed files with 11 additions and 3 deletions
|
|
@ -31,11 +31,11 @@ class Videoob(ConsoleApplication):
|
||||||
self.load_modules(ICapVideoProvider)
|
self.load_modules(ICapVideoProvider)
|
||||||
return self.process_command(*argv[1:])
|
return self.process_command(*argv[1:])
|
||||||
|
|
||||||
@ConsoleApplication.command('Get video information')
|
@ConsoleApplication.command('Get video information (accept ID or URL)')
|
||||||
def command_info(self, _id):
|
def command_info(self, id):
|
||||||
results = {}
|
results = {}
|
||||||
for backend in self.weboob.iter_backends():
|
for backend in self.weboob.iter_backends():
|
||||||
video = backend.get_video(_id)
|
video = backend.get_video(id)
|
||||||
if video is None:
|
if video is None:
|
||||||
continue
|
continue
|
||||||
rows = []
|
rows = []
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,14 @@ class ConsoleApplication(BaseApplication):
|
||||||
self.default_output_format = None
|
self.default_output_format = None
|
||||||
|
|
||||||
def _configure_parser(self, parser):
|
def _configure_parser(self, parser):
|
||||||
|
parser.format_description = lambda x: parser.description
|
||||||
|
|
||||||
|
if parser.description is None:
|
||||||
|
parser.description = ''
|
||||||
|
parser.description += 'Available commands:\n'
|
||||||
|
for f in self._command_help:
|
||||||
|
parser.description += ' %s\n' % f
|
||||||
|
|
||||||
parser.add_option('-o', '--output-format', choices=formatters.keys(),
|
parser.add_option('-o', '--output-format', choices=formatters.keys(),
|
||||||
help='output format %s (default: table)' % formatters.keys())
|
help='output format %s (default: table)' % formatters.keys())
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue