BaseCommand
Sub classes¶
| Name | Children | Inherits |
|---|---|---|
| Command slashed.base Concrete command that can be created directly. |
||
| SlashedCommand slashed.commands Base class for declarative commands. |
Base classes¶
| Name | Children | Inherits |
|---|---|---|
| ABC abc Helper class that provides a standard way to create an ABC using |
⋔ Inheritance diagram¶
graph TD
900363605["base.BaseCommand"]
925645236["abc.ABC"]
2751680898["builtins.object"]
925645236 --> 900363605
2751680898 --> 925645236
🛈 DocStrings¶
Bases: ABC
Abstract base class for commands.
Source code in src/slashed/base.py
raw_args
class-attribute
instance-attribute
¶
Pass the words after the command name unparsed, as positional arguments.
For commands forwarding an argv (/exec git -C dir status): no --flag value
parsing and no --help interception.
execute
abstractmethod
async
¶
execute(ctx: CommandContext[Any], args: list[str], kwargs: dict[str, str]) -> Any
format_usage
¶
get_callable
¶
get_completer
¶
get_completer() -> CompletionProvider | None
is_available
¶
Check if command is currently available.
Override or use condition predicate to implement dynamic availability.
is_visible
¶
is_visible(ctx: CommandContext[Any]) -> bool
Check if command should be visible in command listings.
Override to implement context-dependent visibility. This is called when listing commands to filter which ones should be shown to the user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
CommandContext[Any]
|
The command context, providing access to context data |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if command should be listed, False to hide it |