Esempio 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)
Esempio n. 2
0
 def func():
     raise errors.ArgumentError('test_catch_argumenterror')
Esempio n. 3
0
 def func():
     raise errors.ArgumentError("test_run_fail_exit")
Esempio n. 4
0
def _convert_ioerror(arg, exc):
    nexc = errors.ArgumentError('{0.strerror}: {1!r}'.format(exc, arg))
    nexc.__cause__ = exc
    return nexc
Esempio 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)