Browse Source

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>
2.0
Nico Schottelius 10 years ago
parent
commit
b7a8a84bfc
  1. 8
      bin/cdist

8
bin/cdist

@ -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)

Loading…
Cancel
Save