Welcome to cmdix documentation!#
- cmdix.format_all_help()#
Yields (commandname, commandhelp) for all available commands.
- cmdix.get_parser(commandname)#
- cmdix.getcommand(commandname)#
Returns the parseargs-function of the given commandname. Raises a CommandNotFoundException if the command is not found
- cmdix.handle_args(parser, args, argv)#
- cmdix.listcommands()#
Returns a list of all available commands
- cmdix.onlyunix(f)#
Decorator that indicates that the command cannot be run on windows
- cmdix.run(argv=None)#
Parse commandline arguments and run command. If argv is None, read from sys.argv.
For example:
>>> import cmdix >>> cmdix.run(['seq', '-s', ' to the ', '1', '4']) 1 to the 2 to the 3 to the 4
- Parameters:
argv – List of arguments
- Returns:
The exit status of the command. None means 0.
- cmdix.run_subcommand(commandname, argv)#
Run the subcommand
- cmdix.runcommandline(commandline)#
Process a commandline; main entry-point.
Examples:
>>> import cmdix >>> cmdix.runcommandline('basename /foo/bar/') bar >>> cmdix.runcommandline('cal 2 2000') February 2000 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
- Parameters:
commandline – String representing the commandline, i.e. “ls -l /tmp”