Skip to content

pwd

Class info

Classes

Name Children Inherits
MacOSPwdCommand
anyenv.os_commands.pwd
macOS pwd command implementation.
    UnixPwdCommand
    anyenv.os_commands.pwd
    Unix/Linux pwd command implementation.
      WindowsPwdCommand
      anyenv.os_commands.pwd
      Windows pwd command implementation.

        🛈 DocStrings

        Pwd command implementations for different operating systems.

        MacOSPwdCommand

        Bases: PwdCommand

        macOS pwd command implementation.

        Source code in src/anyenv/os_commands/pwd.py
        class MacOSPwdCommand(PwdCommand):
            """macOS pwd command implementation."""
        
            def create_command(self) -> str:
                """Generate pwd command (same as Unix).
        
                Returns:
                    The pwd command string
                """
                return "pwd"
        
            def parse_command(self, output: str, exit_code: int = 0) -> str | None:
                """Parse pwd result (same as Unix).
        
                Args:
                    output: Raw command output
                    exit_code: Command exit code
        
                Returns:
                    Current working directory or None on failure
                """
                if exit_code != 0:
                    return None
                path = output.strip()
                return path if path else None
        

        create_command

        create_command() -> str
        

        Generate pwd command (same as Unix).

        Returns:

        Type Description
        str

        The pwd command string

        Source code in src/anyenv/os_commands/pwd.py
        def create_command(self) -> str:
            """Generate pwd command (same as Unix).
        
            Returns:
                The pwd command string
            """
            return "pwd"
        

        parse_command

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

        Parse pwd result (same as Unix).

        Parameters:

        Name Type Description Default
        output str

        Raw command output

        required
        exit_code int

        Command exit code

        0

        Returns:

        Type Description
        str | None

        Current working directory or None on failure

        Source code in src/anyenv/os_commands/pwd.py
        def parse_command(self, output: str, exit_code: int = 0) -> str | None:
            """Parse pwd result (same as Unix).
        
            Args:
                output: Raw command output
                exit_code: Command exit code
        
            Returns:
                Current working directory or None on failure
            """
            if exit_code != 0:
                return None
            path = output.strip()
            return path if path else None
        

        UnixPwdCommand

        Bases: PwdCommand

        Unix/Linux pwd command implementation.

        Source code in src/anyenv/os_commands/pwd.py
        class UnixPwdCommand(PwdCommand):
            """Unix/Linux pwd command implementation."""
        
            def create_command(self) -> str:
                """Generate Unix pwd command.
        
                Returns:
                    The pwd command string
                """
                return "pwd"
        
            def parse_command(self, output: str, exit_code: int = 0) -> str | None:
                """Parse Unix pwd result.
        
                Args:
                    output: Raw command output
                    exit_code: Command exit code
        
                Returns:
                    Current working directory or None on failure
                """
                if exit_code != 0:
                    return None
                path = output.strip()
                return path if path else None
        

        create_command

        create_command() -> str
        

        Generate Unix pwd command.

        Returns:

        Type Description
        str

        The pwd command string

        Source code in src/anyenv/os_commands/pwd.py
        def create_command(self) -> str:
            """Generate Unix pwd command.
        
            Returns:
                The pwd command string
            """
            return "pwd"
        

        parse_command

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

        Parse Unix pwd result.

        Parameters:

        Name Type Description Default
        output str

        Raw command output

        required
        exit_code int

        Command exit code

        0

        Returns:

        Type Description
        str | None

        Current working directory or None on failure

        Source code in src/anyenv/os_commands/pwd.py
        def parse_command(self, output: str, exit_code: int = 0) -> str | None:
            """Parse Unix pwd result.
        
            Args:
                output: Raw command output
                exit_code: Command exit code
        
            Returns:
                Current working directory or None on failure
            """
            if exit_code != 0:
                return None
            path = output.strip()
            return path if path else None
        

        WindowsPwdCommand

        Bases: PwdCommand

        Windows pwd command implementation.

        Source code in src/anyenv/os_commands/pwd.py
        class WindowsPwdCommand(PwdCommand):
            """Windows pwd command implementation."""
        
            def create_command(self) -> str:
                """Generate Windows cd command (prints current directory when no args).
        
                Returns:
                    The cd command string
                """
                return "cd"
        
            def parse_command(self, output: str, exit_code: int = 0) -> str | None:
                """Parse Windows cd result.
        
                Args:
                    output: Raw command output
                    exit_code: Command exit code
        
                Returns:
                    Current working directory or None on failure
                """
                if exit_code != 0:
                    return None
                path = output.strip()
                return path if path else None
        

        create_command

        create_command() -> str
        

        Generate Windows cd command (prints current directory when no args).

        Returns:

        Type Description
        str

        The cd command string

        Source code in src/anyenv/os_commands/pwd.py
        def create_command(self) -> str:
            """Generate Windows cd command (prints current directory when no args).
        
            Returns:
                The cd command string
            """
            return "cd"
        

        parse_command

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

        Parse Windows cd result.

        Parameters:

        Name Type Description Default
        output str

        Raw command output

        required
        exit_code int

        Command exit code

        0

        Returns:

        Type Description
        str | None

        Current working directory or None on failure

        Source code in src/anyenv/os_commands/pwd.py
        def parse_command(self, output: str, exit_code: int = 0) -> str | None:
            """Parse Windows cd result.
        
            Args:
                output: Raw command output
                exit_code: Command exit code
        
            Returns:
                Current working directory or None on failure
            """
            if exit_code != 0:
                return None
            path = output.strip()
            return path if path else None