base
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| Base64EncodeCommand anyenv.os_commands.base Base class for base64 encode commands. |
||
| CommandProtocol anyenv.os_commands.base Protocol for all OS commands. |
||
| CopyPathCommand anyenv.os_commands.base Base class for copy path commands. |
||
| CreateDirectoryCommand anyenv.os_commands.base Base class for create directory commands. |
||
| EnvVarCommand anyenv.os_commands.base Base class for environment variable commands. |
||
| ExistsCommand anyenv.os_commands.base Base class for exists commands. |
||
| FileInfoCommand anyenv.os_commands.base Base class for file info commands. |
||
| FindCommand anyenv.os_commands.base Base class for recursive find commands. |
||
| IsDirectoryCommand anyenv.os_commands.base Base class for is directory commands. |
||
| IsFileCommand anyenv.os_commands.base Base class for is file commands. |
||
| ListDirectoryCommand anyenv.os_commands.base Base class for list directory commands. |
||
| PwdCommand anyenv.os_commands.base Base class for pwd (print working directory) commands. |
||
| RemovePathCommand anyenv.os_commands.base Base class for remove path commands. |
||
| WhichCommand anyenv.os_commands.base Base class for which/where commands to locate executables. |
🛈 DocStrings¶
Base protocol and classes for OS-specific commands.
Base64EncodeCommand
¶
Bases: ABC
Base class for base64 encode commands.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
CommandProtocol
¶
Bases: Protocol
Protocol for all OS commands.
Source code in src/anyenv/os_commands/base.py
CopyPathCommand
¶
Bases: ABC
Base class for copy path commands.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
Generate copy command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Source path to copy from |
required |
destination
|
str
|
Destination path to copy to |
required |
recursive
|
bool
|
Whether to copy directories recursively |
False
|
Source code in src/anyenv/os_commands/base.py
parse_command
abstractmethod
¶
Parse copy result.
Returns:
| Type | Description |
|---|---|
bool
|
True if copy was successful, False otherwise |
CreateDirectoryCommand
¶
Bases: ABC
Base class for create directory commands.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
EnvVarCommand
¶
Bases: ABC
Base class for environment variable commands.
Source code in src/anyenv/os_commands/base.py
ExistsCommand
¶
Bases: ABC
Base class for exists commands.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
FileInfoCommand
¶
Bases: ABC
Base class for file info commands.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
FindCommand
¶
Bases: ABC
Base class for recursive find commands.
Used for efficiently finding files/directories recursively in a single command, rather than walking the tree with multiple list operations.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
create_command(
path: str,
pattern: str | None = None,
maxdepth: int | None = None,
file_type: Literal["file", "directory", "all"] = "all",
with_stats: bool = True,
) -> str
Generate recursive find command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Directory to search in |
required |
pattern
|
str | None
|
Glob pattern for name matching (e.g., "*.py") |
None
|
maxdepth
|
int | None
|
Maximum directory depth to descend (None for unlimited) |
None
|
file_type
|
Literal['file', 'directory', 'all']
|
Filter by type - files only, directories only, or all |
'all'
|
with_stats
|
bool
|
Include file stats (size, mtime, type, permissions) |
True
|
Source code in src/anyenv/os_commands/base.py
parse_command
abstractmethod
¶
parse_command(output: str, base_path: str = '') -> list[DirectoryEntry]
Parse find output into DirectoryEntry objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
str
|
Raw command output |
required |
base_path
|
str
|
Base path used in the find command |
''
|
Returns:
| Type | Description |
|---|---|
list[DirectoryEntry]
|
List of DirectoryEntry objects for found items |
Source code in src/anyenv/os_commands/base.py
IsDirectoryCommand
¶
Bases: ABC
Base class for is directory commands.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
IsFileCommand
¶
Bases: ABC
Base class for is file commands.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
ListDirectoryCommand
¶
Bases: ABC
Base class for list directory commands.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
parse_command
abstractmethod
¶
parse_command(output: str, path: str = '') -> list[DirectoryEntry]
PwdCommand
¶
Bases: ABC
Base class for pwd (print working directory) commands.
Source code in src/anyenv/os_commands/base.py
RemovePathCommand
¶
Bases: ABC
Base class for remove path commands.
Source code in src/anyenv/os_commands/base.py
create_command
abstractmethod
¶
WhichCommand
¶
Bases: ABC
Base class for which/where commands to locate executables.