diff options
author | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2017-03-07 03:30:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-03-07 03:30:14 +0000 |
commit | e260a6e8e710b8b92787aa1a6044479bd33ca431 (patch) | |
tree | cd87e58891663f1064dc2988194cbc6d6e0e5ed8 /qtip/cli/entry.py | |
parent | 1622544f850e8076e62ab9585f6421feff4e7c88 (diff) | |
parent | 17c1050f26d6b1693e9731253d8f297aed99fee5 (diff) |
Merge "Implement debug option"
Diffstat (limited to 'qtip/cli/entry.py')
-rw-r--r-- | qtip/cli/entry.py | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/qtip/cli/entry.py b/qtip/cli/entry.py index 9f51f25e..6cf78b58 100644 --- a/qtip/cli/entry.py +++ b/qtip/cli/entry.py @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2016 ZTE Corp and others. +# Copyright (c) 2017 taseer94@gmail.com and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -7,33 +7,19 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +import click import os import sys -import click CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) +# TODO (taseer) define user friendly error messages +sys.tracebacklimit = 0 -class Context(object): - - ''' TODO(taseer) implementation''' - - def __init__(self): - self.verbose = False - self.debug = False - - def log(self, msg, *args): - ''' Log message to stderr ''' - pass - def verbose(self, msg, *args): - ''' Log message to stderr when verbose ''' - pass - - def debug(self, msg, *args): - ''' Log message to debug ''' - pass +class Context(object): + """ Load configuration and pass to subcommands """ pass_context = click.make_pass_decorator(Context, ensure=True) @@ -70,4 +56,5 @@ class QtipCli(click.MultiCommand): @click.version_option('dev') @pass_context def cli(ctx, verbose, debug): - pass + if debug: + sys.tracebacklimit = 8 |