VirtualMailManager/cli/main.py
branchv0.6.x
changeset 420 d4a341248500
parent 417 8209da83e256
child 568 14abdd04ddf5
equal deleted inserted replaced
419:241b192bfcc8 420:d4a341248500
    14 from VirtualMailManager.config import BadOptionError, ConfigValueError
    14 from VirtualMailManager.config import BadOptionError, ConfigValueError
    15 from VirtualMailManager.cli import w_err
    15 from VirtualMailManager.cli import w_err
    16 from VirtualMailManager.cli.handler import CliHandler
    16 from VirtualMailManager.cli.handler import CliHandler
    17 from VirtualMailManager.constants import DATABASE_ERROR, EX_MISSING_ARGS, \
    17 from VirtualMailManager.constants import DATABASE_ERROR, EX_MISSING_ARGS, \
    18      EX_SUCCESS, EX_UNKNOWN_COMMAND, EX_USER_INTERRUPT, INVALID_ARGUMENT
    18      EX_SUCCESS, EX_UNKNOWN_COMMAND, EX_USER_INTERRUPT, INVALID_ARGUMENT
    19 from VirtualMailManager.cli.subcommands import RunContext, cmd_map, usage
    19 from VirtualMailManager.cli.subcommands import RunContext, cmd_map, \
       
    20      update_cmd_map, usage
    20 
    21 
    21 
    22 
    22 _ = lambda msg: msg
    23 _ = lambda msg: msg
    23 
    24 
    24 
    25 
    33         handler.cfg_install()
    34         handler.cfg_install()
    34         return handler
    35         return handler
    35 
    36 
    36 
    37 
    37 def run(argv):
    38 def run(argv):
       
    39     update_cmd_map()
    38     if len(argv) < 2:
    40     if len(argv) < 2:
    39         usage(EX_MISSING_ARGS, _(u"You must specify a subcommand at least."))
    41         usage(EX_MISSING_ARGS, _(u"You must specify a subcommand at least."))
    40 
    42 
    41     sub_cmd = argv[1].lower()
    43     sub_cmd = argv[1].lower()
    42     if sub_cmd in cmd_map:
    44     if sub_cmd in cmd_map: