Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd2/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ class Statement(str): # noqa: SLOT000
whether positional or denoted with switches.

2. For commands with simple positional arguments, use
[args][cmd2.Statement.args] or [arg_list][cmd2.Statement.arg_list]
[args][cmd2.parsing.Statement.args] or [arg_list][cmd2.parsing.Statement.arg_list]

3. If you don't want to have to worry about quoted arguments, see
[argv][cmd2.Statement.argv] for a trick which strips quotes off for you.
[argv][cmd2.parsing.Statement.argv] for a trick which strips quotes off for you.
"""

# the arguments, but not the command, nor the output redirection clauses.
Expand Down Expand Up @@ -193,7 +193,7 @@ def post_command(self) -> str:

@property
def expanded_command_line(self) -> str:
"""Concatenate [command_and_args][cmd2.Statement.command_and_args] and [post_command][cmd2.Statement.post_command]."""
"""Concatenate [cmd2.parsing.Statement.command_and_args]() and [cmd2.parsing.Statement.post_command]()."""
return self.command_and_args + self.post_command

@property
Expand Down
2 changes: 1 addition & 1 deletion docs/features/generating_output.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def do_echo(self, args):

When an error occurs in your program, you can display it on `sys.stderr` by calling the
[perror][cmd2.Cmd.perror] method. By default this method applies
[Cmd2Style.ERROR][cmd2.Cmd2Style.ERROR] to the output.
[Cmd2Style.ERROR][cmd2.styles.Cmd2Style.ERROR] to the output.

## Warning Messages

Expand Down
33 changes: 17 additions & 16 deletions docs/features/modular_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,22 +211,23 @@ if __name__ == '__main__':
The following functions are called at different points in the [CommandSet][cmd2.CommandSet] life
cycle.

[on_register][cmd2.CommandSet.on_register] - Called by `cmd2.Cmd` as the first step to registering a
`CommandSet`. The commands defined in this class have not be added to the CLI object at this point.
Subclasses can override this to perform any initialization requiring access to the Cmd object (e.g.
configure commands and their parsers based on CLI state data).

[on_registered][cmd2.CommandSet.on_registered] - Called by `cmd2.Cmd` after a `CommandSet` is
registered and all its commands have been added to the CLI. Subclasses can override this to perform
custom steps related to the newly added commands (e.g. setting them to a disabled state).

[on_unregister][cmd2.CommandSet.on_unregister] - Called by `cmd2.Cmd` as the first step to
unregistering a `CommandSet`. Subclasses can override this to perform any cleanup steps which
require their commands being registered in the CLI.

[on_unregistered][cmd2.CommandSet.on_unregistered] - Called by `cmd2.Cmd` after a `CommandSet` has
been unregistered and all its commands removed from the CLI. Subclasses can override this to perform
remaining cleanup steps.
[on_register][cmd2.command_definition.CommandSet.on_register] - Called by `cmd2.Cmd` as the first
step to registering a `CommandSet`. The commands defined in this class have not be added to the CLI
object at this point. Subclasses can override this to perform any initialization requiring access to
the Cmd object (e.g. configure commands and their parsers based on CLI state data).

[on_registered][cmd2.command_definition.CommandSet.on_registered] - Called by `cmd2.Cmd` after a
`CommandSet` is registered and all its commands have been added to the CLI. Subclasses can override
this to perform custom steps related to the newly added commands (e.g. setting them to a disabled
state).

[on_unregister][cmd2.command_definition.CommandSet.on_unregister] - Called by `cmd2.Cmd` as the
first step to unregistering a `CommandSet`. Subclasses can override this to perform any cleanup
steps which require their commands being registered in the CLI.

[on_unregistered][cmd2.command_definition.CommandSet.on_unregistered] - Called by `cmd2.Cmd` after a
`CommandSet` has been unregistered and all its commands removed from the CLI. Subclasses can
override this to perform remaining cleanup steps.

## Injecting Subcommands

Expand Down
Loading