do nothing by default and prevent traceback

If not given the function, we get:

aceback (most recent call last):
  File "/home/users/nico/p/cdist/core/bin/cdist", line 243, in <module>
    commandline()
  File "/home/users/nico/p/cdist/core/bin/cdist", line 107, in commandline
    args.func(args)
AttributeError: 'Namespace' object has no attribute 'func'

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-10-24 10:21:38 +02:00
parent 9228168bc9
commit b7a8a84bfc

View file

@ -39,12 +39,15 @@ def commandline():
help='Set log level to info, be more verbose',
action='store_true', default=False)
# Main subcommand parser
# Main parser
parser['main'] = argparse.ArgumentParser(description='cdist ' + cdist.VERSION,
parents=[parser['loglevel']])
parser['main'].add_argument('-V', '--version',
help='Show version', action='version',
version='%(prog)s ' + cdist.VERSION)
#parser['main'].set_defaults(func=commandline_main)
# Subcommand shell
parser['sub'] = parser['main'].add_subparsers(title="Commands")
# Banner
@ -103,6 +106,9 @@ def commandline():
log.debug(args)
args.func(args)
def commandline_main(args):
pass
def config(args):
configinstall(args, mode=cdist.config.Config)