History

python/lib/aubio/cmd.py: improve help output

Paul Brossier committed 9 years ago

Commit 2615dd91 parent 62a94b71 file · +7 −6Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/lib/aubio/cmd.py+7−6
@@ -19,8 +19,8 @@ def aubio_parser(): · 18 unmodified lines
1919 parser.add_argument('-V', '--version', help="show version",
2020 action="store_true", dest="show_version")
2121
22− subparsers = parser.add_subparsers(dest='command',
23− description="", metavar="<command>")
22+ subparsers = parser.add_subparsers(title='commands', dest='command',
23+ metavar="")
2424
2525 # onset subcommand
2626 subparser = subparsers.add_parser('onset',
@@ -354,12 +354,13 @@ class process_melbands(default_process): · 327 unmodified lines
354354 def main():
355355 parser = aubio_parser()
356356 args = parser.parse_args()
357− if args.show_version or ('verbose' in args and args.verbose > 3):
357+ if 'show_version' in args and args.show_version:
358358 sys.stdout.write('aubio version ' + aubio.version + '\n')
359− if args.show_version and args.command is None:
360359 sys.exit(0)
361− if args.command is None:
362− sys.stderr.write("Error: a command is required\n")
360+ elif 'verbose' in args and args.verbose > 3:
361+ sys.stderr.write('aubio version ' + aubio.version + '\n')
362+ if 'command' not in args or args.command is None:
363+ # no command given, print help and return 1
363364 parser.print_help()
364365 sys.exit(1)
365366 elif not args.source_uri and not args.source_uri2:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t