Example #1
0
 def test_ensure_names(self):
     with self.assert_raises(AssertionError):
         ensure_all(["name_that_does_not_exist"])
     ensure_all(["AssertionError"])
Example #2
0
            return u("{0} {1}").format(
                self.application_name,
                Command.get_usage(self)
            )
        return self.usage

    def run(self, arguments=sys.argv[1:], passthrough_errors=False):
        """run(self, arguments=sys.argv[1:], passthrough_errors=False)

        Parses the given `arguments` (default: ``sys.argv[1:]`` and invokes
        :meth:`main()` with the result.

        If `passthrough_errors` (default: ``False``) is ``True``
        :exc:`CLIError`\s will not be caught.
        """
        arguments = Arguments(arguments, self.application_name)
        return Command.run(
            self, arguments, passthrough_errors=passthrough_errors
        )


__all__ = [
    "CLI", "Command", "Option", "Positional", "String", "Bytes", "Integer",
    "Float", "Complex", "Decimal", "Any", "Number", "Choice", "Boolean",
    "NativeString", "Mapping", "store_last", "append_to_list", "add_to_set",
    "add", "sub", "File", "Resource", "LocalResource"
]
# This should probably be a test, even though I think Python should raise an
# exception if __all__ is ill-defined, instead of ignoring it.
ensure_all(__all__)