Skip to content

CommandProtocol

Base classes

Name Children Inherits
Protocol
typing
Base class for protocol classes.

⋔ Inheritance diagram

graph TD
  1804988423["base.CommandProtocol"]
  1073422405["typing.Protocol"]
  3481597255["typing.Generic"]
  2751680898["builtins.object"]
  1073422405 --> 1804988423
  3481597255 --> 1073422405
  2751680898 --> 3481597255

🛈 DocStrings

Bases: Protocol

Protocol for all OS commands.

Source code in src/anyenv/os_commands/base.py
class CommandProtocol(Protocol):
    """Protocol for all OS commands."""

    def create_command(self, *args: Any, **kwargs: Any) -> str:
        """Generate the OS-specific command string."""
        ...

    def parse_command(self, output: str, exit_code: int = 0, *args: Any, **kwargs: Any) -> Any:
        """Parse the command output."""
        ...

create_command

create_command(*args: Any, **kwargs: Any) -> str

Generate the OS-specific command string.

Source code in src/anyenv/os_commands/base.py
def create_command(self, *args: Any, **kwargs: Any) -> str:
    """Generate the OS-specific command string."""
    ...

parse_command

parse_command(output: str, exit_code: int = 0, *args: Any, **kwargs: Any) -> Any

Parse the command output.

Source code in src/anyenv/os_commands/base.py
def parse_command(self, output: str, exit_code: int = 0, *args: Any, **kwargs: Any) -> Any:
    """Parse the command output."""
    ...

:fa-brands-github: Show source on GitHub