VirtualMailManager/cli/main.py
branchv0.6.x
changeset 417 8209da83e256
parent 366 d6573da35b5f
child 420 d4a341248500
equal deleted inserted replaced
416:f32b323fd347 417:8209da83e256
    34         return handler
    34         return handler
    35 
    35 
    36 
    36 
    37 def run(argv):
    37 def run(argv):
    38     if len(argv) < 2:
    38     if len(argv) < 2:
    39         usage(EX_MISSING_ARGS, _(u"You must specify a subcommand at least"))
    39         usage(EX_MISSING_ARGS, _(u"You must specify a subcommand at least."))
    40 
    40 
    41     sub_cmd = argv[1].lower()
    41     sub_cmd = argv[1].lower()
    42     if sub_cmd in cmd_map:
    42     if sub_cmd in cmd_map:
    43         cmd_func = cmd_map[sub_cmd].func
    43         cmd_func = cmd_map[sub_cmd].func
    44     else:
    44     else:
    63             w_err(err.code, _(u'Error: %s') % err.msg)
    63             w_err(err.code, _(u'Error: %s') % err.msg)
    64         w_err(err.code, unicode(err.msg, ENCODING, 'replace'))
    64         w_err(err.code, unicode(err.msg, ENCODING, 'replace'))
    65     except (BadOptionError, ConfigValueError), err:
    65     except (BadOptionError, ConfigValueError), err:
    66         w_err(INVALID_ARGUMENT, _(u'Error: %s') % err)
    66         w_err(INVALID_ARGUMENT, _(u'Error: %s') % err)
    67     except NoSectionError, err:
    67     except NoSectionError, err:
    68         w_err(INVALID_ARGUMENT, _(u"Error: No section '%s'") % err.section)
    68         w_err(INVALID_ARGUMENT,
       
    69               _(u"Error: Unknown section: '%s'") % err.section)
    69     except NoOptionError, err:
    70     except NoOptionError, err:
    70         w_err(INVALID_ARGUMENT,
    71         w_err(INVALID_ARGUMENT,
    71               _(u"Error: No option '%(option)s' in section: '%(section)s'") %
    72               _(u"Error: No option '%(option)s' in section: '%(section)s'") %
    72               {'option': err.option, 'section': err.section})
    73               {'option': err.option, 'section': err.section})
    73     if handler.has_warnings():
    74     if handler.has_warnings():