diff --git a/mopidy/__main__.py b/mopidy/__main__.py index af83dcd8..bc5ca86c 100644 --- a/mopidy/__main__.py +++ b/mopidy/__main__.py @@ -31,9 +31,18 @@ def main(): signal.signal(signal.SIGUSR1, pykka.debug.log_thread_tracebacks) parser = commands.build_parser() + subparser = parser.add_subparsers(title='commands', metavar='COMMAND') + + run_parser = subparser.add_parser('run', help='start mopidy server') + run_parser.set_defaults(command='run') + config_parser = subparser.add_parser('config', help='show current config') + config_parser.set_defaults(command='config') + deps_parser = subparser.add_parser('deps', help='show dependencies') + deps_parser.set_defaults(command='deps') + args = parser.parse_args(args=mopidy_args) - if args.show_deps or args.show_config: + if args.command in ('config', 'deps'): args.verbosity_level -= 1 bootstrap_logging(args) @@ -61,13 +70,12 @@ def main(): log_extension_info(installed_extensions, enabled_extensions) - # TODO: move to 'mopidy config' and 'mopidy deps' - if args.show_config: + if args.command == 'config': logger.info('Dumping sanitized user config and exiting.') print config_lib.format( config, installed_extensions, config_errors) sys.exit(0) - if args.show_deps: + elif args.command == 'deps': logger.info('Dumping debug info about dependencies and exiting.') print deps.format_dependency_list() sys.exit(0) diff --git a/mopidy/commands.py b/mopidy/commands.py index 36269dca..480e0f04 100644 --- a/mopidy/commands.py +++ b/mopidy/commands.py @@ -37,14 +37,6 @@ def build_parser(): '--save-debug-log', action='store_true', dest='save_debug_log', help='save debug log to "./mopidy.log"') - parser.add_argument( - '--show-config', - action='store_true', dest='show_config', - help='show current config') - parser.add_argument( - '--show-deps', - action='store_true', dest='show_deps', - help='show dependencies and their versions') parser.add_argument( '--config', action='store', dest='config_files', type=config_files_type, diff --git a/tests/help_test.py b/tests/help_test.py index 574e4fd7..75d545bc 100644 --- a/tests/help_test.py +++ b/tests/help_test.py @@ -22,6 +22,5 @@ class HelpTest(unittest.TestCase): self.assertIn('--quiet', output) self.assertIn('--verbose', output) self.assertIn('--save-debug-log', output) - self.assertIn('--show-config', output) self.assertIn('--config', output) self.assertIn('--option', output)