Merge pull request #139 from mesosphere/better-help
Better help messaging, partially completes DCOS-509.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Get and set DCOS command line options
|
||||
"""Get and set DCOS CLI configuration properties
|
||||
|
||||
Usage:
|
||||
dcos config --info
|
||||
|
||||
@@ -15,6 +15,7 @@ import futures
|
||||
from dcos.api import cmds, emitting, options, subcommand, util
|
||||
|
||||
emitter = emitting.FlatEmitter()
|
||||
logger = util.get_logger(__name__)
|
||||
|
||||
|
||||
def main():
|
||||
@@ -56,6 +57,7 @@ def _help(show_info):
|
||||
return 0
|
||||
|
||||
directory = util.dcos_path()
|
||||
logger.debug("DCOS Path: {!r}".format(directory))
|
||||
|
||||
paths = subcommand.list_paths(directory)
|
||||
with futures.ThreadPoolExecutor(max_workers=len(paths)) as executor:
|
||||
@@ -67,7 +69,7 @@ def _help(show_info):
|
||||
"System (DCOS). The Mesosphere DCOS is a distributed operating\n"
|
||||
"system built around Apache Mesos. This utility provides tools\n"
|
||||
"for easy management of a DCOS installation.\n")
|
||||
emitter.publish("Available DCOS commands in {!r}:".format(directory))
|
||||
emitter.publish("Available DCOS commands:")
|
||||
emitter.publish(commands_message)
|
||||
emitter.publish(
|
||||
"\nGet detailed command description with 'dcos <command> --help'.")
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
"""
|
||||
Command line utility for the Mesosphere Datacenter Operating
|
||||
System (DCOS)
|
||||
|
||||
'dcos help' lists all available subcommands. See 'dcos <command> --help'
|
||||
to read about a specific subcommand.
|
||||
|
||||
Usage:
|
||||
dcos [options] [<command>] [<args>...]
|
||||
|
||||
@@ -22,8 +28,6 @@ Environment Variables:
|
||||
DCOS_CONFIG This environment variable points to the
|
||||
location of the DCOS configuration file.
|
||||
|
||||
'dcos help' lists all available subcommands. See 'dcos <command> --help'
|
||||
to read about a specific subcommand.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@@ -22,7 +22,7 @@ def test_help():
|
||||
returncode, stdout, stderr = exec_command(['dcos', 'config', '--help'])
|
||||
|
||||
assert returncode == 0
|
||||
assert stdout == b"""Get and set DCOS command line options
|
||||
assert stdout == b"""Get and set DCOS CLI configuration properties
|
||||
|
||||
Usage:
|
||||
dcos config --info
|
||||
@@ -51,7 +51,7 @@ def test_info():
|
||||
returncode, stdout, stderr = exec_command(['dcos', 'config', '--info'])
|
||||
|
||||
assert returncode == 0
|
||||
assert stdout == b'Get and set DCOS command line options\n'
|
||||
assert stdout == b'Get and set DCOS CLI configuration properties\n'
|
||||
assert stderr == b''
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import os
|
||||
|
||||
from dcos.api import constants, util
|
||||
from dcos.api import constants
|
||||
|
||||
from common import exec_command
|
||||
|
||||
|
||||
def test_default():
|
||||
dcos_path = os.path.dirname(os.path.dirname(util.which('dcos')))
|
||||
returncode, stdout, stderr = exec_command(['dcos'])
|
||||
|
||||
assert returncode == 0
|
||||
@@ -16,16 +15,16 @@ System (DCOS). The Mesosphere DCOS is a distributed operating
|
||||
system built around Apache Mesos. This utility provides tools
|
||||
for easy management of a DCOS installation.
|
||||
|
||||
Available DCOS commands in '{}':
|
||||
Available DCOS commands:
|
||||
|
||||
\tconfig \tGet and set DCOS command line options
|
||||
\tconfig \tGet and set DCOS CLI configuration properties
|
||||
\thelp \tDisplay command line usage information
|
||||
\tmarathon \tDeploy and manage applications on the DCOS
|
||||
\tpackage \tInstall and manage DCOS software packages
|
||||
\tsubcommand \tInstall and manage DCOS CLI subcommands
|
||||
|
||||
Get detailed command description with 'dcos <command> --help'.
|
||||
""".format(dcos_path).encode('utf-8')
|
||||
""".encode('utf-8')
|
||||
assert stderr == b''
|
||||
|
||||
|
||||
@@ -33,7 +32,14 @@ def test_help():
|
||||
returncode, stdout, stderr = exec_command(['dcos', '--help'])
|
||||
|
||||
assert returncode == 0
|
||||
assert stdout == b"""Usage:
|
||||
assert stdout == b"""\
|
||||
Command line utility for the Mesosphere Datacenter Operating
|
||||
System (DCOS)
|
||||
|
||||
'dcos help' lists all available subcommands. See 'dcos <command> --help'
|
||||
to read about a specific subcommand.
|
||||
|
||||
Usage:
|
||||
dcos [options] [<command>] [<args>...]
|
||||
|
||||
Options:
|
||||
@@ -55,9 +61,6 @@ Environment Variables:
|
||||
|
||||
DCOS_CONFIG This environment variable points to the
|
||||
location of the DCOS configuration file.
|
||||
|
||||
'dcos help' lists all available subcommands. See 'dcos <command> --help'
|
||||
to read about a specific subcommand.
|
||||
"""
|
||||
assert stderr == b''
|
||||
|
||||
@@ -102,7 +105,7 @@ def test_log_level_flag():
|
||||
['dcos', '--log-level=info', 'config', '--info'])
|
||||
|
||||
assert returncode == 0
|
||||
assert stdout == b"Get and set DCOS command line options\n"
|
||||
assert stdout == b"Get and set DCOS CLI configuration properties\n"
|
||||
|
||||
|
||||
def test_capital_log_level_flag():
|
||||
@@ -110,7 +113,7 @@ def test_capital_log_level_flag():
|
||||
['dcos', '--log-level=INFO', 'config', '--info'])
|
||||
|
||||
assert returncode == 0
|
||||
assert stdout == b"Get and set DCOS command line options\n"
|
||||
assert stdout == b"Get and set DCOS CLI configuration properties\n"
|
||||
|
||||
|
||||
def test_invalid_log_level_flag():
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import os
|
||||
|
||||
from dcos.api import util
|
||||
|
||||
from common import exec_command
|
||||
|
||||
|
||||
@@ -40,7 +36,6 @@ def test_version():
|
||||
|
||||
|
||||
def test_list():
|
||||
dcos_path = os.path.dirname(os.path.dirname(util.which('dcos')))
|
||||
returncode, stdout, stderr = exec_command(['dcos', 'help'])
|
||||
|
||||
assert returncode == 0
|
||||
@@ -50,14 +45,14 @@ System (DCOS). The Mesosphere DCOS is a distributed operating
|
||||
system built around Apache Mesos. This utility provides tools
|
||||
for easy management of a DCOS installation.
|
||||
|
||||
Available DCOS commands in '{}':
|
||||
Available DCOS commands:
|
||||
|
||||
\tconfig \tGet and set DCOS command line options
|
||||
\tconfig \tGet and set DCOS CLI configuration properties
|
||||
\thelp \tDisplay command line usage information
|
||||
\tmarathon \tDeploy and manage applications on the DCOS
|
||||
\tpackage \tInstall and manage DCOS software packages
|
||||
\tsubcommand \tInstall and manage DCOS CLI subcommands
|
||||
|
||||
Get detailed command description with 'dcos <command> --help'.
|
||||
""".format(dcos_path).encode('utf-8')
|
||||
""".encode('utf-8')
|
||||
assert stderr == b''
|
||||
|
||||
Reference in New Issue
Block a user