Skip to content

EnvVarCommand

Sub classes

Name Children Inherits
UnixEnvVarCommand
anyenv.os_commands.env_var
Unix/Linux environment variable command implementation.
    MacOSEnvVarCommand
    anyenv.os_commands.env_var
    macOS environment variable command implementation.
      WindowsEnvVarCommand
      anyenv.os_commands.env_var
      Windows environment variable 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
          931535557["base.EnvVarCommand"]
          925645236["abc.ABC"]
          2751680898["builtins.object"]
          925645236 --> 931535557
          2751680898 --> 925645236

        🛈 DocStrings

        Bases: ABC

        Base class for environment variable commands.

        Source code in src/anyenv/os_commands/base.py
        class EnvVarCommand(ABC):
            """Base class for environment variable commands."""
        
            @abstractmethod
            def create_command(self, name: str) -> str:
                """Generate command to get environment variable value."""
        
            @abstractmethod
            def parse_command(self, output: str, exit_code: int = 0) -> str | None:
                """Parse output and return variable value or None if not set."""
        

        create_command abstractmethod

        create_command(name: str) -> str
        

        Generate command to get environment variable value.

        Source code in src/anyenv/os_commands/base.py
        @abstractmethod
        def create_command(self, name: str) -> str:
            """Generate command to get environment variable value."""
        

        parse_command abstractmethod

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

        Parse output and return variable value or None if not set.

        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 variable value or None if not set."""
        

        :fa-brands-github: Show source on GitHub