Skip to content

Commit 4fa0411

Browse files
committed
docs: add missing CLI options, API params, and 17 integration tests
1 parent 6c057ac commit 4fa0411

2 files changed

Lines changed: 395 additions & 1 deletion

File tree

CLAUDE.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,37 @@ children:
4141
```bash
4242
treemapper . # YAML to stdout
4343
treemapper . -o tree.yaml # save to file
44+
treemapper . -o - # explicit stdout output
4445
treemapper . --format json # JSON format
4546
treemapper . --format text # tree-style text
4647
treemapper . --no-content # structure only (no file contents)
4748
treemapper . --max-depth 3 # limit directory depth
4849
treemapper . --max-file-bytes 10000 # skip files larger than 10KB
4950
treemapper . -i custom.ignore # custom ignore patterns
51+
treemapper . --no-default-ignores # disable .gitignore/.treemapperignore (custom -i still works)
52+
treemapper . -v 2 # verbose output (0=ERROR, 1=WARNING, 2=INFO, 3=DEBUG)
53+
treemapper --version # show version
5054
```
5155

5256
## Python API
5357

5458
```python
5559
from treemapper import map_directory, to_yaml, to_json, to_text
5660

57-
# Get tree as dict
61+
# Full function signature
62+
tree = map_directory(
63+
path, # directory path (str or Path)
64+
max_depth=None, # limit traversal depth
65+
no_content=False, # exclude file contents
66+
max_file_bytes=None, # skip files larger than N bytes
67+
ignore_file=None, # custom ignore file path
68+
no_default_ignores=False, # disable .gitignore/.treemapperignore
69+
)
70+
71+
# Examples
5872
tree = map_directory("./myproject")
5973
tree = map_directory("./src", max_depth=2, no_content=True)
74+
tree = map_directory(".", max_file_bytes=50000, ignore_file="custom.ignore")
6075

6176
# Serialize to string
6277
yaml_str = to_yaml(tree)
@@ -68,6 +83,20 @@ text_str = to_text(tree)
6883

6984
Respects `.gitignore` and `.treemapperignore` automatically. Use `--no-default-ignores` to include everything.
7085

86+
Features:
87+
- Hierarchical: nested `.gitignore`/`.treemapperignore` files work at each directory level
88+
- Negation patterns: `!important.log` un-ignores a file
89+
- Anchored patterns: `/root_only.txt` matches only in root, `*.log` matches everywhere
90+
- Output file is always auto-ignored (prevents recursive inclusion)
91+
92+
## Content Placeholders
93+
94+
When file content cannot be read normally, placeholders are used:
95+
- `<file too large: N bytes>` — file exceeds `--max-file-bytes` limit
96+
- `<binary file: N bytes>` — file detected as binary (contains null bytes)
97+
- `<unreadable content: not utf-8>` — file is not valid UTF-8
98+
- `<unreadable content>` — file cannot be read (permission denied, I/O error)
99+
71100
## Development
72101

73102
```bash

0 commit comments

Comments
 (0)