rbtools.commands¶
Base support for creating commands.
Functions
|
Determine if the given command exists. |
|
Return an entry point for the given RBTools command. |
Classes
|
Abstract base class for commands which offer subcommands. |
|
Abstract base class for a subcommand. |
|
Legacy base class for commands. |
|
Output wrapper for JSON output. |
|
Filters log messages of a given level. |
|
Represents an option for a command. |
|
Represents a named group of options. |
|
Wrapper for output of a command. |
|
Smartly formats help text, preserving paragraphs. |
- class rbtools.commands.JSONOutput(*args, **kwargs)[source]¶
Bases:
ClassMovedMixin
,JSONOutput
Output wrapper for JSON output.
JSON outputter class that stores Command outputs in python dictionary and outputs as JSON object to output stream object. Commands should add any structured output to this object. JSON output is then enabled with the –json argument.
Deprecated since version 5.0: Consumers should use
rbtools.commands.output.JSONOutput
instead.This will be removed in RBTools 6.
New in version 3.0.
- class rbtools.commands.SmartHelpFormatter(*args, **kwargs)[source]¶
Bases:
ClassMovedMixin
,SmartHelpFormatter
Smartly formats help text, preserving paragraphs.
Deprecated since version 5.0: Consumers should use
rbtools.commands.base.commands.SmartHelpFormatter
instead.This will be removed in RBTools 6.
- class rbtools.commands.OutputWrapper(*args, **kwargs)[source]¶
Bases:
ClassMovedMixin
,OutputWrapper
Wrapper for output of a command.
Wrapper around some output object that handles outputting messages. Child classes specify the default object. The wrapper can handle messages in either unicode or bytes.
New in version 3.0.
- __parameters__ = ()¶
- class rbtools.commands.Option(*args, **kwargs)[source]¶
Bases:
ClassMovedMixin
,Option
Represents an option for a command.
The arguments to the constructor should be treated like those to argparse’s add_argument, with the exception that the keyword argument ‘config_key’ is also valid. If config_key is provided it will be used to retrieve the config value as a default if the option is not specified. This will take precedence over the default argument.
Serves as a wrapper around the ArgumentParser options, allowing us to specify defaults which will be grabbed from the configuration after it is loaded.
Deprecated since version 5.0: Consumers should use
rbtools.commands.base.options.Option
instead.This will be removed in RBTools 6.
- class rbtools.commands.OptionGroup(*args, **kwargs)[source]¶
Bases:
ClassMovedMixin
,OptionGroup
Represents a named group of options.
Each group has a name, an optional description, and a list of options. It serves as a way to organize related options, making it easier for users to scan for the options they want.
This works like argparse’s argument groups, but is designed to work with our special Option class.
Deprecated since version 5.0: Consumers should use
rbtools.commands.base.options.OptionGroup
instead.This will be removed in RBTools 6.
- class rbtools.commands.LogLevelFilter(*args, **kwargs)[source]¶
Bases:
ClassMovedMixin
,LogLevelFilter
Filters log messages of a given level.
Only log messages that have the specified level will be allowed by this filter. This prevents propagation of higher level types to lower log handlers.
Deprecated since version 5.0: Consumers should use
rbtools.commands.base.commands.LogLevelFilter
instead.This will be removed in RBTools 6.
- class rbtools.commands.Command(*args, **kwargs)[source]¶
Bases:
ClassMovedMixin
,BaseCommand
Legacy base class for commands.
Deprecated since version 5.0: Subclasses should inherit from
rbtools.commands.base.commands.BaseCommand
(or a more specific subclass) instead.This will be removed in RBTools 6.
- class rbtools.commands.BaseSubCommand(*args, **kwargs)[source]¶
Bases:
ClassMovedMixin
,BaseSubCommand
Abstract base class for a subcommand.
Deprecated since version 5.0: Subclasses should inherit from
rbtools.commands.base.commands.BaseSubCommand
instead.This will be removed in RBTools 6.
- class rbtools.commands.BaseMultiCommand(*args, **kwargs)[source]¶
Bases:
ClassMovedMixin
,BaseMultiCommand
Abstract base class for commands which offer subcommands.
Some commands (such as rbt review) want to offer many subcommands.
Deprecated since version 5.0: Subclasses should inherit from
rbtools.commands.base.commands.BaseMultiCommand
instead.This will be removed in RBTools 6.
New in version 3.0.
- rbtools.commands.find_entry_point_for_command(command_name: str) Optional[EntryPoint] [source]¶
Return an entry point for the given RBTools command.
Changed in version 5.0: This has been updated to return a modern
importlib.metadata.EntryPoint
.- Parameters:
command_name (
str
) – The name of the command to find.- Returns:
The resulting entry point, if found, or
None
if not found.- Return type:
importlib.metadata.EntryPoint