diff options
author | zhihui wu <wu.zhihui1@zte.com.cn> | 2017-06-06 06:17:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-06-06 06:17:52 +0000 |
commit | 0dffb7f523b9681533517b61436e9010d67def47 (patch) | |
tree | 708172056280bfc096476268e05654c0fc8a6e8e /qtip/cli/entry.py | |
parent | 0ce21bc2fc83faa3462de9fd52360cb0d6fae71d (diff) | |
parent | 30f07d0e8e2d82e613155e218d92f126ad1316bf (diff) |
Merge "Refactor Cli"
Diffstat (limited to 'qtip/cli/entry.py')
-rw-r--r-- | qtip/cli/entry.py | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/qtip/cli/entry.py b/qtip/cli/entry.py index b557047d..0825d5e1 100644 --- a/qtip/cli/entry.py +++ b/qtip/cli/entry.py @@ -9,22 +9,12 @@ import click import os -import pkg_resources as pkg import sys from qtip.cli.commands.cmd_project import cli as project_commands -CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) -# TODO (taseer) define user friendly error messages sys.tracebacklimit = 0 - - -class Context(object): - """ Load configuration and pass to subcommands """ - - -pass_context = click.make_pass_decorator(Context, ensure=True) cmd_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), 'commands')) @@ -51,9 +41,9 @@ class SubCommand(click.MultiCommand): return mod.cli -@click.command(cls=SubCommand, context_settings=CONTEXT_SETTINGS, +@click.command(cls=SubCommand, invoke_without_command=True) -def sub_commands(ctx, verbose, debug): +def sub_commands(debug): pass @@ -61,10 +51,8 @@ def sub_commands(ctx, verbose, debug): help="Platform performance benchmarking", sources=[sub_commands, project_commands], invoke_without_command=True) -@click.option('-v', '--verbose', is_flag=True, help='Enable verbose mode.') @click.option('-d', '--debug', is_flag=True, help='Enable debug mode.') -@click.version_option(pkg.require("qtip")[0]) -@pass_context -def cli(ctx, verbose, debug): +@click.version_option() +def cli(debug): if debug: sys.tracebacklimit = 8 |