taucmdr.cli package¶
TAU Commander command line interface (CLI).
The TAU Commander CLI is composed of a single top-level command that invokes
subcommands, much like git. For example, the command line
tau project create my_new_project invokes the create subcommand of the
project subcommand with the arguments my_new_project.
Every package in taucmdr.cli.commands is a TAU Commander subcommand. Modules
in the package are that subcommand’s subcommands. This can be nested as deep as
you like. Subcommand modules must have a COMMAND member which is an instance of
a subclass of AbstractCommand.
- exception taucmdr.cli.AmbiguousCommandError(value, matches, *hints)[source]¶
Bases:
ConfigurationErrorIndicates that a specified partial command is ambiguous.
- message_fmt = "Command '%(value)s' is ambiguous.\n\n%(hints)s"¶
Format string for the error message.
- exception taucmdr.cli.UnknownCommandError(value, *hints)[source]¶
Bases:
ConfigurationErrorIndicates that a specified command is unknown.
- message_fmt = '%(value)r is not a valid TAU command.\n\n%(hints)s'¶
Format string for the error message.
- taucmdr.cli._command_as_list(module_name)[source]¶
Converts a module name to a command name list.
Maps command module names to their command line equivilants, e.g. ‘taucmdr.cli.commands.target.create’ => [‘tau’, ‘target’, ‘create’]
- taucmdr.cli._get_commands(package_name)[source]¶
Returns a dictionary mapping commands to Python modules.
Given a root module name, return a dictionary that maps commands and their subcommands to Python modules. The special key
__module__maps to the command module. Other strings map to subcommands of the command.- Parameters:
package_name (str) – A string naming the module to search for cli.
- Returns:
Strings mapping to dictionaries or modules.
- Return type:
Example:
_get_commands('taucmdr.cli.commands.target') ==> {'__module__': <module 'taucmdr.cli.commands.target' from '/home/jlinford/workspace/taucmdr/packages/taucmdr/cli/commands/target/__init__.pyc'>, 'create': {'__module__': <module 'taucmdr.cli.commands.target.create' from '/home/jlinford/workspace/taucmdr/packages/taucmdr/cli/commands/target/create.pyc'>}, 'delete': {'__module__': <module 'taucmdr.cli.commands.target.delete' from '/home/jlinford/workspace/taucmdr/packages/taucmdr/cli/commands/target/delete.pyc'>}, 'edit': {'__module__': <module 'taucmdr.cli.commands.target.edit' from '/home/jlinford/workspace/taucmdr/packages/taucmdr/cli/commands/target/edit.pyc'>}, 'list': {'__module__': <module 'taucmdr.cli.commands.target.list' from '/home/jlinford/workspace/taucmdr/packages/taucmdr/cli/commands/target/list.pyc'>}}
- taucmdr.cli.command_from_module_name(module_name)[source]¶
Converts a module name to a command name string.
Maps command module names to their command line equivilants, e.g. ‘taucmdr.cli.commands.target.create’ => ‘tau target create’
- taucmdr.cli.commands_description(package_name='taucmdr.cli.commands')[source]¶
Builds listing of command names with short description.
- taucmdr.cli.execute_command(cmd, cmd_args=None, parent_module=None)[source]¶
Import the command module and run its main routine.
Partial commands are allowed, e.g. cmd=[‘tau’, ‘cli’, ‘commands’, ‘app’, ‘cre’] will resolve to ‘taucmdr.cli.commands.application.create’. If the command can’t be found then the parent command (if any) will be invoked with the
--helpflag.- Parameters:
cmd (list) – List of strings identifying the command, i.e. from
_command_as_list.cmd_args (list) – Command line arguments to be parsed by command.
parent_module (str) – Dot-seperated name of the command’s parent.
- Raises:
UnknownCommandError – cmd is invalid.
AmbiguousCommandError – cmd is ambiguous.
- Returns:
Command return code.
- Return type:
- taucmdr.cli.find_command(cmd)[source]¶
Import the command module and return its COMMAND member.
- Parameters:
cmd (list) – List of strings identifying the command, i.e. from
_command_as_list.- Raises:
UnknownCommandError – cmd is invalid.
AmbiguousCommandError – cmd is ambiguous.
- Returns:
Command object for the subcommand.
- Return type:
- taucmdr.cli.get_all_commands(package_name='taucmdr.cli.commands')[source]¶
Builds a list of all commands and subcommands.
Subpackages¶
- taucmdr.cli.commands package
- Subpackages
- taucmdr.cli.commands.application package
- taucmdr.cli.commands.experiment package
- taucmdr.cli.commands.measurement package
- taucmdr.cli.commands.project package
- taucmdr.cli.commands.system package
- taucmdr.cli.commands.target package
- taucmdr.cli.commands.tests package
- taucmdr.cli.commands.trial package
- Submodules
- Subpackages
- taucmdr.cli.tests package
Submodules¶
- taucmdr.cli.arguments module
ActionArgumentErrorArgumentsNamespaceConsoleHelpFormatterHelpFormatterHelpFormatter._format_action_invocation()HelpFormatter._format_args()HelpFormatter._format_meta_arg()HelpFormatter._format_optional()HelpFormatter._format_optional_arg()HelpFormatter._format_positional()HelpFormatter._format_requred_arg()HelpFormatter._get_help_string()HelpFormatter._split_lines()
MutableArgumentGroupMutableArgumentGroupParserParseBooleanActionParsePackagePathActionREMAINDERSTORAGE_LEVEL_FLAGSUPPRESSadd_storage_flag()get_parser()get_parser_from_model()parse_storage_flag()
- taucmdr.cli.cli_view module
AbstractCliViewCopyCommandCreateCommandDeleteCommandEditCommandListCommandListCommand._abc_implListCommand._construct_parser()ListCommand._count_records()ListCommand._format_long_item()ListCommand._format_records()ListCommand._list_records()ListCommand._retrieve_records()ListCommand.dashboard_format()ListCommand.long_format()ListCommand.main()ListCommand.short_format()
RootCommandTexttable
- taucmdr.cli.command module
AbstractCommandAbstractCommand.module_nameAbstractCommand.commandAbstractCommand.groupAbstractCommand._abc_implAbstractCommand._construct_parser()AbstractCommand._parse_args()AbstractCommand.format_usage()AbstractCommand.help_pageAbstractCommand.main()AbstractCommand.parserAbstractCommand.summaryAbstractCommand.usage