Skip to main content

Copy file contents under a directory to clipboard with tree and optional git log.

Project description

pylistall

PyPI version Python versions License

中文说明

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 (by default, only files in the current directory are included)

  • Display absolute path

  • Recursive traversal of subdirectories (optional, disabled by default)

  • Include or exclude files using glob patterns (optional, includes all non-binary files by default)

  • Include binary files (optional, disabled by default)

  • Include Git log (optional, disabled by default)

  • Cross-platform support:

    • macOS (pbcopy)
    • Windows (clip)
    • Linux (xclip or pyperclip fallback)

Installation

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:

STRUCTURE:
/Users/example/project
├── main.py
└── utils.py

GIT LOG:
a1b2c3d (HEAD -> main) Initial commit

`main.py`:
```

print("Hello")

```

`utils.py`:
```

def func():
    pass

```

Options

Recursive traversal

-r, --recursive

Recursively include files in subdirectories. Optional, disabled by default. When enabled, both the tree structure and copied file contents will include files from the current directory, subdirectories, and all nested subdirectories.

Example:

pylistall -r

Include binary files

-b, --binary

Include binary files. Optional, disabled by default. When enabled, binary file contents will be included like regular files. Regardless of whether this option is enabled, binary file names will always appear in the tree structure.

Example:

pylistall -b

Include Git log

-g, --git-log [N]

Optional, disabled by default. Behavior depends on usage:

Command Result
no -g do not include Git log
-g include all Git log entries
-g N include the last N Git log entries

Examples:

pylistall -g
pylistall -g 5

When enabled, if the ROOT directory does not contain a .git folder, a message will be shown.


Include only specific files

-i, --include PATTERN

Include only files matching glob patterns. Optional, disabled by default. When enabled, both the tree structure and copied file contents will include only the selected files. Multiple patterns can be separated by commas.

Examples:

pylistall -i "*.py"
pylistall -i "*.py,README.md"

Omit specific files

-o, --omit PATTERN

Exclude files matching glob patterns. Optional, disabled by default. When enabled, both the tree structure and copied file contents will exclude the selected files. Multiple patterns can be separated by commas.

Examples:

pylistall -o "*.log"
pylistall -o "*.log,*.tmp"

Limit file read size

--max-bytes N

Limit the maximum number of bytes read per file. Optional, disabled by default. When enabled, reading of each file will be limited to at most N bytes.

Example:

pylistall --max-bytes 10000

Examples

Basic usage:

pylistall

Recursive traversal with Git log:

pylistall -r -g 3

Include binary files:

pylistall -b

Include only Python files:

pylistall -i "*.py"

Exclude test files:

pylistall -o "test_*"

Clipboard Support

Platform-specific clipboard backends:

Platform Backend
macOS pbcopy
Windows clip
Linux xclip / pyperclip

No additional configuration is required on macOS or Windows.


Requirements

Python 3.9 or higher


License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylistall-0.2.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylistall-0.2.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file pylistall-0.2.1.tar.gz.

File metadata

  • Download URL: pylistall-0.2.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.1

File hashes

Hashes for pylistall-0.2.1.tar.gz
Algorithm Hash digest
SHA256 201cb2f675190ada1529aaa0a2750beeeef07ba46028b641ac4a54576a4b5559
MD5 5d69343218d554ae3494924e8077dbc6
BLAKE2b-256 8e559ef8d5948a64e192895c301e4796878d8e626f78ee9723f6b36000592af7

See more details on using hashes here.

File details

Details for the file pylistall-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pylistall-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.1

File hashes

Hashes for pylistall-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb95565e11ca7b9ab37576b42b47716209b9d64fa4b3d25ed6edd464402ea5fc
MD5 d0bf8094fc0ed67811c22529382049ab
BLAKE2b-256 bd18f8db82a236dce6bf69419f3cfaf83295e4771cc93c0fe3d9874fa70e5f8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page