module documentation
Shared CLI objects, used by .ui and .formats.
| Class | |
Base class for all commands. |
| Class | |
Base class for all subcommands. |
| Class | |
Base class for all subcommands of NestedTextTo. |
| Class | |
Base class for all subcommands of ToNestedText. |
| Class | |
Mixin for SubcommandOfNestedTextTo+SupportsTypes commands which support dates. |
| Class | |
Mixin for SubcommandOfNestedTextTo+SupportsTypes commands which support null. |
| Class | |
Mixin for SubcommandOfNestedTextTo commands which support types. |
| Class | |
Base class for commands that convert to NestedText. |
| Function | description |
Add DESCRIPTION_MORE to a 2nt subcommand class. |
| Function | description |
Add DESCRIPTION_MORE to a subcommand class. |
| Function | description |
Add DESCRIPTION_MORE to an nt2 subcommand class. |
| Function | docstring |
Add a docstring to a subcommand class, using its DOCSTRING_TMPL and OTHER_FORMAT. |
| Function | get |
Return the stdout content from the given command invocation. |
| Function | invoke |
Invoke the command with the given arguments. |
| Function | propagate |
Add user-supplied opts from the root to its nested command, unless supplied there, too. |
def description_more_for_2nt_subcommand(cls:
type[ SubcommandOfToNestedText]) -> type[ SubcommandOfToNestedText]:
(source)
¶
Add DESCRIPTION_MORE to a 2nt subcommand class.
Makes use of its OTHER_FORMAT and DESCRIPTION_MORE_TMPL attributes.
| Parameters | |
cls:type[ | A SubcommandOfToNestedText class. |
| Returns | |
type[ | The same cls, with DESCRIPTION_MORE added. |
def description_more_for_subcommand(cls:
type[ SupportsTypes] | type[ SubcommandOfToNestedText]) -> type[ SupportsTypes] | type[ SubcommandOfToNestedText]:
(source)
¶
Add DESCRIPTION_MORE to a subcommand class.
Dispatches to description_more_for_supports_types and description_more_for_2nt_subcommand.
| Parameters | |
cls:type[ | A SupportsTypes (and SubcommandOfNestedTextTo) or SubcommandOfToNestedText class. |
| Returns | |
type[ | The same cls, with DESCRIPTION_MORE added. |
def description_more_for_supports_types(cls:
type[ SupportsTypes]) -> type[ SupportsTypes]:
(source)
¶
Add DESCRIPTION_MORE to an nt2 subcommand class.
Makes use of its OTHER_FORMAT and DESCRIPTION_MORE_TMPL attributes, as well as its mixin inheritance.
| Parameters | |
cls:type[ | A SubcommandOfNestedTextTo class which supports types. |
| Returns | |
type[ | The same cls, with DESCRIPTION_MORE added. |
def docstring_for_subcommand(cls:
type[ SubcommandOfNestedTextTo | SubcommandOfToNestedText]) -> type[ SubcommandOfNestedTextTo | SubcommandOfToNestedText]:
(source)
¶
Add a docstring to a subcommand class, using its DOCSTRING_TMPL and OTHER_FORMAT.
| Parameters | |
cls:type[ | A SubcommandOfNestedTextTo or SubcommandOfToNestedText class. |
| Returns | |
type[ | The same cls, with a docstring added. |
def get_ntt_stdout(command:
Command, ntt_error_kwargs: dict[ str, Any], *args: Any, **kwargs: Any) -> str:
(source)
¶
Return the stdout content from the given command invocation.
| Parameters | |
command:Command | The command to invoke. |
nttdict[ | The keyword arguments to pass to the NTTError constructor. |
*args:Any | The positional arguments to pass to the command. |
**kwargs:Any | The keyword arguments to pass to the command. |
| Returns | |
str | The stdout content from the given command invocation. |
| Raises | |
NTTError | If the command fails. |
Exception | If the command raises a very unexpected exception. |
def invoke_ntt_command(command:
Command, ntt_error_kwargs: dict[ str, Any], *args: Any, **kwargs: Any):
(source)
¶
Invoke the command with the given arguments.
| Parameters | |
command:Command | The command to invoke. |
nttdict[ | The keyword arguments to pass to the NTTError constructor. |
*args:Any | The positional arguments to pass to the command. |
**kwargs:Any | The keyword arguments to pass to the command. |
| Raises | |
NTTError | If the command fails. |
Add user-supplied opts from the root to its nested command, unless supplied there, too.
| Parameters | |
root:Command | The root (parent) Command. |
optionSequence[ | The names of the options to propagate as they appear on the command line, but without the leading dashes. For example, ['inline-width']. |
| Raises | |
NTTError | If no subcommand is detected. |