From 79f6987fa59858d042fc77b6e9bb84d90ff0ae86 Mon Sep 17 00:00:00 2001 From: Sunil Shah Date: Thu, 19 Feb 2015 17:28:48 -0800 Subject: [PATCH] Make command listing default behaviour for dcos help and small grammatical fixes. --- dcos/cli/help/main.py | 18 ++++++++++-------- dcos/cli/main.py | 10 +++++----- integrations/cli/test_dcos.py | 8 ++++---- integrations/cli/test_help.py | 13 +++++++------ tests/data/Dcos.toml | 2 +- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/dcos/cli/help/main.py b/dcos/cli/help/main.py index a46f103..406a3a5 100644 --- a/dcos/cli/help/main.py +++ b/dcos/cli/help/main.py @@ -1,12 +1,13 @@ """ Usage: - dcos help info + dcos help dcos help --all + dcos help info Options: - -h, --help Show this screen + --help Show this screen --version Show version - --all Prints all the avaible commands to the standard output + --all Prints all available commands to the standard output """ import os @@ -29,10 +30,11 @@ def main(): version='dcos-help version {}'.format(constants.version)) if args['help'] and args['info']: - emitter.publish('Display help information about DCOS') - elif args['help'] and args['--all']: + emitter.publish('Display usage information') + # Note: this covers --all. When --all is different, + elif args['help']: directory = _binary_directory(os.environ[constants.DCOS_PATH_ENV]) - emitter.publish("Available DCOS command in '{}':".format(directory)) + emitter.publish("Available DCOS commands in '{}':".format(directory)) emitter.publish( options.make_command_summary_string( _external_command_documentation( @@ -101,9 +103,9 @@ def _binary_directory(dcos_path): def _external_command_documentation(commands): """Gather sub-command summary - :param commands: List of subcommand + :param commands: List of subcommands :type comands: list of str - :returns: Returns a list of subcommand and their summary + :returns: Returns a list of subcommands and their summary :rtype: list of (str, str) """ def info(command): diff --git a/dcos/cli/main.py b/dcos/cli/main.py index 63a1cba..2211314 100644 --- a/dcos/cli/main.py +++ b/dcos/cli/main.py @@ -1,9 +1,9 @@ """ Usage: - dcos [--log-level=] [...] + dcos [options] [...] Options: - -h, --help Show this screen + --help Show this screen --version Show version --log-level= If set then print supplementary messages to stderr at or above this level. The severity @@ -22,8 +22,8 @@ Environment Variables: DCOS_CONFIG This environment variable points to the location of the DCOS configuration file. -'dcos help --all' lists available subcommands. See 'dcos --help' to -read about a specific subcommand. +'dcos help --all' lists all available subcommands. See 'dcos --help' +to read about a specific subcommand. """ @@ -60,7 +60,7 @@ def main(): return subprocess.call([command] + argv) else: emitter.publish( - "{!r} is not a dcos command. See 'dcos --help'.".format( + "{!r} is not a dcos command. See 'dcos help'.".format( args[''])) return 1 diff --git a/integrations/cli/test_dcos.py b/integrations/cli/test_dcos.py index d000be4..29f8397 100644 --- a/integrations/cli/test_dcos.py +++ b/integrations/cli/test_dcos.py @@ -9,10 +9,10 @@ def test_help(): assert returncode == 0 assert stdout == b"""Usage: - dcos [--log-level=] [...] + dcos [options] [...] Options: - -h, --help Show this screen + --help Show this screen --version Show version --log-level= If set then print supplementary messages to stderr at or above this level. The severity @@ -31,8 +31,8 @@ Environment Variables: DCOS_CONFIG This environment variable points to the location of the DCOS configuration file. -'dcos help --all' lists available subcommands. See 'dcos --help' to -read about a specific subcommand. +'dcos help --all' lists all available subcommands. See 'dcos --help' +to read about a specific subcommand. """ assert stderr == b'' diff --git a/integrations/cli/test_help.py b/integrations/cli/test_help.py index d60993b..dc7fe1d 100644 --- a/integrations/cli/test_help.py +++ b/integrations/cli/test_help.py @@ -7,13 +7,14 @@ def test_help(): assert returncode == 0 assert stdout == b"""Usage: - dcos help info + dcos help dcos help --all + dcos help info Options: - -h, --help Show this screen + --help Show this screen --version Show version - --all Prints all the avaible commands to the standard output + --all Prints all available commands to the standard output """ assert stderr == b'' @@ -22,7 +23,7 @@ def test_info(): returncode, stdout, stderr = exec_command(['dcos', 'help', 'info']) assert returncode == 0 - assert stdout == b'Display help information about DCOS\n' + assert stdout == b'Display usage information\n' assert stderr == b'' @@ -38,11 +39,11 @@ def test_list_all(): returncode, stdout, stderr = exec_command(['dcos', 'help', '--all']) assert returncode == 0 - assert stdout == """Available DCOS command in '{}': + assert stdout == """Available DCOS commands in '{}': \tapp \tDeploy and manage applications on Apache Mesos \tconfig \tGet and set DCOS command line options -\thelp \tDisplay help information about DCOS +\thelp \tDisplay usage information \tmarathon \tDeploy and manage applications on Apache Mesos \tpackage \tInstall and manage DCOS software packages diff --git a/tests/data/Dcos.toml b/tests/data/Dcos.toml index cb5a9bf..af3133b 100644 --- a/tests/data/Dcos.toml +++ b/tests/data/Dcos.toml @@ -1,6 +1,6 @@ [package] -cache = "tmp/cache" sources = [ "git://github.com/mesosphere/universe.git",] +cache = "tmp/cache" [marathon] host = "localhost" port = 8080