Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tfeldmann committed Jan 5, 2024
1 parent 342a418 commit 2546345
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
27 changes: 5 additions & 22 deletions docs/locations.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ rules:
rules:
- locations:
- path: ...
min_depth: ...
max_depth: ...
search: ...
exclude_files: ...
Expand All @@ -53,6 +54,10 @@ rules:
**path** (`str`)<br>
Path to a local folder

**min_depth** (`int` or `null`)<br>
Minimum directory depth to search. This can be useful if you want to only handle files
in subdirectories of `location`.

**max_depth** (`int` or `null`)<br>
Maximum directory depth to search.

Expand Down Expand Up @@ -86,28 +91,6 @@ All other files are skipped.
A list of patterns to match directory names that are included in this location.
All other directories are skipped.

**filesystem** (str)<br>
A [Filesystem URL](#filesystems).

### `filesystem` and `path`

If you want the location to be the root (`"/"`) of a filesystem, use `path`:

```yml
rules:
- locations:
- path: zip:///Users/theuser/Downloads/Test.zip
```

If you want the location to be a subfolder inside a filesystem, use `path` and `filesystem`:

```yml
rules:
- locations:
- filesystem: zip:///Users/theuser/Downloads/Test.zip
path: "/folder/in/the/zipfile/"
```

### `max_depth` and `subfolders`

- If `subfolders: true` is specified on the rule, all locations are set to `max_depth: null`
Expand Down
1 change: 1 addition & 0 deletions organize/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@dataclass(config=ConfigDict(extra="forbid"))
class Location(BaseModel):
path: FlatList[str]
min_depth: int = 0
max_depth: Union[Literal["inherit"], int, None] = "inherit"
search: Literal["depth", "breadth"] = "breadth"
exclude_files: Set[str] = Field(default_factory=set)
Expand Down
2 changes: 1 addition & 1 deletion organize/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def walk(self, rule_nr: int = 0):
max_depth = location.max_depth

walker = Walker(
min_depth=0,
min_depth=location.min_depth,
max_depth=max_depth,
filter_dirs=location.filter_dirs,
filter_files=location.filter,
Expand Down

0 comments on commit 2546345

Please sign in to comment.