Show help if user types in just dcos

This commit is contained in:
Sunil Shah
2015-04-05 23:31:50 -07:00
parent 0ff0a89e7d
commit 2c34e94e41
2 changed files with 29 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
"""
Usage:
dcos [options] <command> [<args>...]
dcos [options] [<command>] [<args>...]
Options:
--help Show this screen
@@ -56,6 +56,9 @@ def main():
command = args['<command>']
if not command:
command = "help"
executable, err = subcommand.command_executables(command, util.dcos_path())
if err is not None:
emitter.publish(err)

View File

@@ -1,16 +1,39 @@
import os
from dcos.api import constants
from dcos.api import constants, util
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
assert stdout == """Command line utility for \
the Mesosphere Datacenter Operating 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 '{}':
\tconfig \tGet and set DCOS command line options
\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')
assert stderr == b''
def test_help():
returncode, stdout, stderr = exec_command(['dcos', '--help'])
assert returncode == 0
assert stdout == b"""Usage:
dcos [options] <command> [<args>...]
dcos [options] [<command>] [<args>...]
Options:
--help Show this screen