file_info
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| MacOSFileInfoCommand anyenv.os_commands.file_info macOS file info command implementation using ls -la. |
||
| UnixFileInfoCommand anyenv.os_commands.file_info Unix/Linux file info command implementation using ls -la. |
||
| WindowsFileInfoCommand anyenv.os_commands.file_info Windows file info command implementation. |
🛈 DocStrings¶
File info command implementations for different operating systems.
MacOSFileInfoCommand
¶
Bases: FileInfoCommand
macOS file info command implementation using ls -la.
Source code in src/anyenv/os_commands/file_info.py
create_command
¶
Generate ls -la command for file info.
Uses ls -la instead of stat to avoid shell expansion issues with format specifiers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to get information about |
required |
Returns:
| Type | Description |
|---|---|
str
|
The ls command string |
Source code in src/anyenv/os_commands/file_info.py
parse_command
¶
parse_command(output: str, path: str) -> FileInfo
Parse ls -la output for a single file/directory.
BSD ls output format is same as Unix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
str
|
Raw ls -la command output |
required |
path
|
str
|
Original path requested |
required |
Returns:
| Type | Description |
|---|---|
FileInfo
|
FileInfo object with parsed information |
Source code in src/anyenv/os_commands/file_info.py
UnixFileInfoCommand
¶
Bases: FileInfoCommand
Unix/Linux file info command implementation using ls -la.
Source code in src/anyenv/os_commands/file_info.py
create_command
¶
Generate ls -la command for file info.
Uses ls -la instead of stat to avoid shell expansion issues with format specifiers like %s, %F, etc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to get information about |
required |
Returns:
| Type | Description |
|---|---|
str
|
The ls command string |
Source code in src/anyenv/os_commands/file_info.py
parse_command
¶
parse_command(output: str, path: str) -> FileInfo
Parse ls -la output for a single file/directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
str
|
Raw ls -la command output |
required |
path
|
str
|
Original path requested |
required |
Returns:
| Type | Description |
|---|---|
FileInfo
|
FileInfo object with parsed information |
Source code in src/anyenv/os_commands/file_info.py
WindowsFileInfoCommand
¶
Bases: FileInfoCommand
Windows file info command implementation.
Source code in src/anyenv/os_commands/file_info.py
create_command
¶
Generate PowerShell file info command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to get information about |
required |
Returns:
| Type | Description |
|---|---|
str
|
The PowerShell command string |
Source code in src/anyenv/os_commands/file_info.py
parse_command
¶
parse_command(output: str, path: str) -> FileInfo
Parse PowerShell output format: name||size||type||mtime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
str
|
Raw PowerShell command output |
required |
path
|
str
|
Original path requested |
required |
Returns:
| Type | Description |
|---|---|
FileInfo
|
FileInfo object with parsed information |