Ejemplo n.º 1
0
 def _cli(self, name, command, *args):
     try:
         func = self.cmds_by_name[command.lower()]
     except KeyError:
         guess = util.closest_option(command, list(self.cmds_by_name))
         if guess:
             raise errors.ArgumentError(
                 'Unknown command "{0}". Did you mean "{1}"?'.format(
                     command, guess))
         raise errors.ArgumentError('Unknown command "{0}"'.format(command))
     return func('{0} {1}'.format(name, command), *args)
Ejemplo n.º 2
0
 def func():
     raise errors.ArgumentError('test_catch_argumenterror')
Ejemplo n.º 3
0
 def func():
     raise errors.ArgumentError("test_run_fail_exit")
Ejemplo n.º 4
0
def _convert_ioerror(arg, exc):
    nexc = errors.ArgumentError('{0.strerror}: {1!r}'.format(exc, arg))
    nexc.__cause__ = exc
    return nexc
Ejemplo n.º 5
0
 def cli(self, name, command, *args):
     try:
         func = self.cmds_by_name[command]
     except KeyError:
         raise errors.ArgumentError('Unknwon command "{0}"'.format(command))
     return func('{0} {1}'.format(name, command), *args)