UnixFindCommand
Base classes¶
| Name | Children | Inherits |
|---|---|---|
| FindCommand anyenv.os_commands.base Base class for recursive find commands. |
â‹” Inheritance diagram¶
graph TD
3717835885["find.UnixFindCommand"]
1345197150["base.FindCommand"]
925645236["abc.ABC"]
2751680898["builtins.object"]
1345197150 --> 3717835885
925645236 --> 1345197150
2751680898 --> 925645236
🛈 DocStrings¶
Bases: FindCommand
Unix/Linux find command implementation.
Source code in src/anyenv/os_commands/find.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
create_command
¶
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 Unix 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
|
file_type
|
Literal['file', 'directory', 'all']
|
Filter by type - files only, directories only, or all |
'all'
|
with_stats
|
bool
|
Include file stats using -printf (size, mtime, type, perms) |
True
|
Returns:
| Type | Description |
|---|---|
str
|
The find command string |
Source code in src/anyenv/os_commands/find.py
parse_command
¶
parse_command(output: str, base_path: str = '') -> list[DirectoryEntry]
Parse Unix find output.
Handles both plain path output and -printf formatted output with stats. Detects format automatically based on presence of tab separators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
str
|
Raw find command output |
required |
base_path
|
str
|
Base path used in the find command |
''
|
Returns:
| Type | Description |
|---|---|
list[DirectoryEntry]
|
List of DirectoryEntry objects |