Skip to content

WhichCommand

Sub classes

Name Children Inherits
UnixWhichCommand
anyenv.os_commands.which
Unix/Linux which command implementation.
    MacOSWhichCommand
    anyenv.os_commands.which
    macOS which command implementation.
      WindowsWhichCommand
      anyenv.os_commands.which
      Windows where command implementation.

        Base classes

        Name Children Inherits
        ABC
        abc
        Helper class that provides a standard way to create an ABC using

        ⋔ Inheritance diagram

        graph TD
          2658962468["base.WhichCommand"]
          925645236["abc.ABC"]
          2751680898["builtins.object"]
          925645236 --> 2658962468
          2751680898 --> 925645236

        🛈 DocStrings

        Bases: ABC

        Base class for which/where commands to locate executables.

        Source code in src/anyenv/os_commands/base.py
        class WhichCommand(ABC):
            """Base class for which/where commands to locate executables."""
        
            @abstractmethod
            def create_command(self, executable: str) -> str:
                """Generate command to find executable path."""
        
            @abstractmethod
            def parse_command(self, output: str, exit_code: int = 0) -> str | None:
                """Parse output and return executable path or None if not found."""
        

        create_command abstractmethod

        create_command(executable: str) -> str
        

        Generate command to find executable path.

        Source code in src/anyenv/os_commands/base.py
        @abstractmethod
        def create_command(self, executable: str) -> str:
            """Generate command to find executable path."""
        

        parse_command abstractmethod

        parse_command(output: str, exit_code: int = 0) -> str | None
        

        Parse output and return executable path or None if not found.

        Source code in src/anyenv/os_commands/base.py
        @abstractmethod
        def parse_command(self, output: str, exit_code: int = 0) -> str | None:
            """Parse output and return executable path or None if not found."""
        

        :fa-brands-github: Show source on GitHub