Make command listing default behaviour for dcos help and small grammatical fixes.
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"""
|
||||
Usage:
|
||||
dcos [--log-level=<log-level>] <command> [<args>...]
|
||||
dcos [options] <command> [<args>...]
|
||||
|
||||
Options:
|
||||
-h, --help Show this screen
|
||||
--help Show this screen
|
||||
--version Show version
|
||||
--log-level=<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 <command> --help' to
|
||||
read about a specific subcommand.
|
||||
'dcos help --all' lists all available subcommands. See 'dcos <command> --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['<command>']))
|
||||
return 1
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ def test_help():
|
||||
|
||||
assert returncode == 0
|
||||
assert stdout == b"""Usage:
|
||||
dcos [--log-level=<log-level>] <command> [<args>...]
|
||||
dcos [options] <command> [<args>...]
|
||||
|
||||
Options:
|
||||
-h, --help Show this screen
|
||||
--help Show this screen
|
||||
--version Show version
|
||||
--log-level=<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 <command> --help' to
|
||||
read about a specific subcommand.
|
||||
'dcos help --all' lists all available subcommands. See 'dcos <command> --help'
|
||||
to read about a specific subcommand.
|
||||
"""
|
||||
assert stderr == b''
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
cache = "tmp/cache"
|
||||
sources = [ "git://github.com/mesosphere/universe.git",]
|
||||
cache = "tmp/cache"
|
||||
[marathon]
|
||||
host = "localhost"
|
||||
port = 8080
|
||||
|
||||
Reference in New Issue
Block a user