Generate and export directory tree structures with optional color output.
Project description
Directory Tree Script
This script generates a visual representation of the directory structure of a specified root directory. It supports exporting the structure to a Markdown file and offers various options to customize the output.
Usage: tree-script [SWITCHES] directory
Generate a directory tree structure for a given path, with options for depth
limitation, colorful output, file sizes, and exporting to Markdown.
positional arguments:
directory Path to the root directory to analyze
optional arguments:
-h, --help Show this help message and exit
-md, --export-md Export the directory structure to a Markdown file
-d DEPTH, --depth DEPTH
Limit the depth of directory traversal (e.g., -d 2)
-v, --verbose Enable verbose logging for debugging purposes
-c, --color Enable colorful output for better readability
-s, --size Show file sizes and line counts in the output
Examples:
tree-script /path/to/directory
tree-script /path/to/directory -d 2 -s
tree-script /path/to/directory -md -c
Example Output
Installation
pip install tree-scribe
Or
pipx install tree-scribe
Command-Line Switches
| Switch/Option | Description | Example Usage |
|---|---|---|
<directory-path> |
Path to the root directory whose structure you want to display. | tree-scribe /home/project |
-md, --export-md |
Export the directory structure to a Markdown file. | tree-scribe /home/project -md |
-d, --depth <number> |
Limit the depth of directory traversal. | tree-scribe /home/project -d 2 |
-v, --verbose |
Enable verbose logging for detailed output. | tree-scribe /home/project -v |
-c, --color |
Enable colorful output in the terminal. | tree-scribe /home/project -c |
-s, --size |
Show line and size. | tree-scribe /home/project -s |
--exclude |
Exclude file and folder. | tree_scribe /path/to/directory --exclude dist build .git |
Examples
-
Display the Directory Structure
tree-scribe /home/project -
Export to Markdown
tree-scribe /home/project --export-md
-
Limit Depth to 2 Levels
tree-scribe /home/project --depth 2
-
Enable Verbose Logging
tree-scribe /home/project --verbose
-
Enable Colorful Output
tree-scribe /home/project -c
-
Show line and size
tree-scribe /home/project -s
-
Combine Options
tree-scribe /home/project --export-md --depth 3 -c -s
-
Exclude files or folder
tree_scribe /path/to/directory --exclude dist build .git
Troubleshooting
- Permission Errors: If you encounter permission errors, make sure you have the necessary permissions to access the directories and files.
- Invalid Directory Path: Ensure the specified directory path is correct and exists.
License
This script is provided under the MIT License. See the LICENSE file for more information.
Contributing
Feel free to submit issues, suggestions, or pull requests. Contributions are welcome!
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
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 tree_scribe-0.0.7.tar.gz.
File metadata
- Download URL: tree_scribe-0.0.7.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c37034ca182c3f815c16aabe9d1301a942df660842ff32d919406f7247409c01
|
|
| MD5 |
10b4f4969aadb6afde6848815929b014
|
|
| BLAKE2b-256 |
739166e0737b91920044372f82626aca9380d29aa6470cb1cfc6a4dd4dc63979
|
Provenance
The following attestation bundles were made for tree_scribe-0.0.7.tar.gz:
Publisher:
main.yml on mamad-1999/tree-scribe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_scribe-0.0.7.tar.gz -
Subject digest:
c37034ca182c3f815c16aabe9d1301a942df660842ff32d919406f7247409c01 - Sigstore transparency entry: 154059433
- Sigstore integration time:
-
Permalink:
mamad-1999/tree-scribe@8b135a997db1a03f3c87eb648374daa98334716e -
Branch / Tag:
refs/tags/0.0.7 - Owner: https://github.com/mamad-1999
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@8b135a997db1a03f3c87eb648374daa98334716e -
Trigger Event:
release
-
Statement type:
File details
Details for the file tree_scribe-0.0.7-py3-none-any.whl.
File metadata
- Download URL: tree_scribe-0.0.7-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0db1ac7d6b26deed0da4f9b1a6f94b45a5d9ba21aa82ffac2452845a5c5a218
|
|
| MD5 |
45bb700a748922d298cdc932261be9f0
|
|
| BLAKE2b-256 |
3251236d9269fafebc1f202dc36e0c32a04972b079ef6372ffd9f1a7e3119e27
|
Provenance
The following attestation bundles were made for tree_scribe-0.0.7-py3-none-any.whl:
Publisher:
main.yml on mamad-1999/tree-scribe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_scribe-0.0.7-py3-none-any.whl -
Subject digest:
d0db1ac7d6b26deed0da4f9b1a6f94b45a5d9ba21aa82ffac2452845a5c5a218 - Sigstore transparency entry: 154059434
- Sigstore integration time:
-
Permalink:
mamad-1999/tree-scribe@8b135a997db1a03f3c87eb648374daa98334716e -
Branch / Tag:
refs/tags/0.0.7 - Owner: https://github.com/mamad-1999
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@8b135a997db1a03f3c87eb648374daa98334716e -
Trigger Event:
release
-
Statement type: