Copy file contents under a directory to clipboard with tree and optional git log.
Project description
pylistall
pylistall is a cross-platform command-line tool that collects file contents under a directory and copies them to the system clipboard in a structured format.
It also prints the absolute path and a tree-style directory structure. If the directory contains a .git repository, it can optionally include the Git commit log.
This tool is designed for efficiently sharing project context with AI tools, debugging, documentation, or code review.
Features
-
Copy file contents directly to clipboard
-
Tree-style directory structure output
-
Display absolute path
-
Recursive traversal of subdirectories (optional, disabled by default)
-
Include or omit files using glob patterns (optional, includes all non-binary files by default)
-
Include binary files (optional, disabled by default)
-
Git log output (optional, disabled by default)
-
Cross-platform support:
- macOS (
pbcopy) - Windows (
clip) - Linux (
xcliporpyperclipfallback)
- macOS (
Installation
Using PyPI:
python -m pip install pylistall
Or, from the project root (where pyproject.toml is located):
python -m pip install .
Verify installation:
pylistall --help
Uninstall:
python -m pip uninstall pylistall
Usage
pylistall [path] [options]
If [path] is not provided, the current directory (.) is used.
Output Format
Example input:
cd /Users/example/project
pylistall . -r -o -g
Example output:
/Users/example/project
├── .git/
│ ├── HEAD
│ ├── config
│ └── ...
├── src/
│ └── main.py
└── README.txt
/Users/example/project/.git
a1b2c3d (HEAD -> main) Initial commit
`README.txt`:
```
This is an exmaple Project.
```
`src/main.py`:
```
print("Hello World!")
```
Notes:
- The tree always reflects the real filesystem.
- Tree behavior is only affected by
-r, not affected by-i,-o, or-b. - Directories end with
/.
Options
Recursive traversal
-r, --recursive
Recursively include subdirectories.
When enabled:
- Tree will include files from the current directory, subdirectories, and all nested subdirectories
- Copied file content will include files in all these directories
- Will try to find Git logs in all directories
Optional, disabled by default.
Print copied content
-p, --print
Print the full generated output to stdout.
Optional, disabled by default.
Include only specific files
-i, --include PATTERN
Include only files matching glob patterns, using Comma-separated patterns.
When -i is used:
- Only matching files are included in content output (whitelist mode)
-ican force-include binary files even if-bis not provided
Optional, repeatable, disabled by default.
Omit specific files
-o, --omit [PATTERN]
Exclude files matching glob patterns, using Comma-separated patterns.
Behavior:
-
If
-ois provided without[PATTERN], a default omit set is enabled. The default set includes:.git/**,**/__pycache__/**,**/.pytest_cache/**,**/.mypy_cache/**,**/.ruff_cache/**,**/.tox/**,**/.venv/**,**/venv/**,**/build/**,**/dist/**,**/*.egg-info/**,**/node_modules/**,**/.idea/**,**/.vscode/**,**/.gitignore,**/.DS_Store,**/Thumbs.db -
If both default and custom omit rules are desired, repeat
-o:
pylistall -o -o "README.md,test_cases/*"
Optional, repeatable, disabled by default.
Binary files
-b, --binary [PATTERN]
Controls whether binary files are included in content output. Does not affact non-binary files.
Precedence rules:
-oalways omits matching files (including binariy files).-ican force-include specific binary files.-bcontrols only remaining binary files.
Inclusion rules:
- Not provided (disabled) → binary files excluded (unless forced by
-i) -b→ include all binary files-b [PATTERN]→ include only binary files matching[PATTERN]
Examples:
pylistall -b
pylistall -b "*.zip,photo.png"
pylistall -i "run.exe"
Default set of binary files:
.png, .jpg, .jpeg, .gif, .webp, .bmp, .ico, .pdf, .zip, .rar, .7z, .tar, .gz, .bz2, .xz, .exe, .dll, .so, .dylib, .bin, .dat, .class, .jar, .pyc, .pyo, .woff, .woff2, .ttf, .otf, .mp3, .wav, .flac, .mp4, .mov, .mkv, .avi, .doc, .docx
Optional, disabled by default.
Git log
-g, --git-log [N]
Include Git log output.
Behavior:
- If not provided (disabled) → no Git logs
-g→ include all entries-g N→ include last N entries
Rules:
-
If no
.gitentry is found,[No .git found]is included in the output. -
Without
-r, only the.gitfolder or file in the root folder is checked. -
With
-r,.gitentries are discovered recursively. -
Each Git log group is prefixed with the absolute
.gitpath. -
Multiple
.gitare printed as separate groups.When multiple
.gitentries are found:- They are sorted by path (case-insensitive), separated by blank lines.
- If both a
.gitdirectory and a.gitfile exist at the same path, the directory is printed first and the file second.
Optional, disabled by default.
Limit file read size
-m, --max-bytes N
Limit the maximum number of bytes read per file.
If content exceeds N bytes, it is truncated and marked.
Optional, disabled by default.
Examples
Basic usage:
pylistall
Recursive traversal with 3 recent Git logs:
pylistall -r -g 3
Enable default omit set:
pylistall -o
Allow all binary files:
pylistall -b
Include only Python files:
pylistall -i "*.py"
Exclude all files that starts with test_ in test folder:
pylistall -o "test/test_*"
Clipboard Support
Platform-specific clipboard backends:
| Platform | Backend |
|---|---|
| macOS | pbcopy |
| Windows | clip |
| Linux | xclip / pyperclip |
Requirements
Python 3.9 or higher
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylistall-0.3.0.tar.gz.
File metadata
- Download URL: pylistall-0.3.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9eb9c6cc6d3b35c17d8f167c27cee3faa2a541a8d321d75e36618fdb5b31709
|
|
| MD5 |
29ac84040c1b3fc1a8a409a98c30eb65
|
|
| BLAKE2b-256 |
0bf6f32582ff1e3b2b132f30c857444bbbccc2e71b3270b4bc8b3c177709856a
|
File details
Details for the file pylistall-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pylistall-0.3.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a8132b0841bbf8d2b6c5c259fa0fd94e528398ad5a9dad919a8aa47ae833cc4
|
|
| MD5 |
a874067563d1c38d41ab234cfe378ae5
|
|
| BLAKE2b-256 |
6a32dfb5c0550c1e516c52ef27d18bdab172bfe50a881394ab40bb0a00297e66
|