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.
Example Output
├── .env
├── .gitignore
├── README.md
├── config/
│ ├── env.go
├── data/
│ ├── found-url.json
│ ├── url.txt
├── db/
│ ├── db.go
├── directory_structure.md
├── go.mod
├── go.sum
├── main.go
├── rss/
│ ├── fetch.go
├── telegram/
│ ├── telegram.go
├── utils/
├── http.go
├── utils.go
Features
- Visual Directory Tree: Display the directory structure in a tree-like format.
- Export to Markdown: Save the directory structure to a Markdown file for documentation purposes.
- Depth Limiting: Limit the depth of directory traversal to avoid overwhelming outputs for deep directory structures.
- Colorful Output: Colorize the terminal output to differentiate directories from files.
Installation
pip install tree-scribe
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 |
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
-
Combine Options
tree-scribe /home/project --export-md --depth 3 -c
Notes
- Colorful Output: The
-cor--colorswitch enables colorful terminal output usingcolorama. Without this switch, the output will be plain text. - Depth Limiting: Use the
--depthoption to control how many levels deep the directory tree should be displayed. - Verbose Mode: The
--verboseoption provides more detailed logging information during script execution. - Markdown Export: The
--export-mdoption saves the directory structure to a Markdown file for documentation purposes.
For any additional options or troubleshooting, please refer to the Troubleshooting section of this documentation.
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!
Summary of Additions
- Customizing Filters: Instructions for modifying the
filters.pyfile to include or exclude specific directories from the output. - Adding/Removing Folders: Clear steps on how to update the
EXCLUDED_DIRECTORIESlist.
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.3.tar.gz.
File metadata
- Download URL: tree_scribe-0.0.3.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab40683fca590539617b0cb52b63af31f4d65802b9ba8d49401a06666cae4253
|
|
| MD5 |
47de65bbd915d91d6485d1ba678e2ef1
|
|
| BLAKE2b-256 |
bac45b765837d1015f53d6347bbe855a5e69a37ce272c337b635b10907488d0d
|
Provenance
The following attestation bundles were made for tree_scribe-0.0.3.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.3.tar.gz -
Subject digest:
ab40683fca590539617b0cb52b63af31f4d65802b9ba8d49401a06666cae4253 - Sigstore transparency entry: 153969809
- Sigstore integration time:
-
Permalink:
mamad-1999/tree-scribe@3a8a17993aa5f802205fda416ead158843a50aaf -
Branch / Tag:
refs/tags/0.0.3 - Owner: https://github.com/mamad-1999
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@3a8a17993aa5f802205fda416ead158843a50aaf -
Trigger Event:
release
-
Statement type:
File details
Details for the file tree_scribe-0.0.3-py3-none-any.whl.
File metadata
- Download URL: tree_scribe-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.4 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 |
ca99a1c5dfee5d6caf3319a3fb79d102e810add8797456a6b46512b4351c16d1
|
|
| MD5 |
a4a2403d6c34e3d787537c4e53ba5dbb
|
|
| BLAKE2b-256 |
a0b362d8dab98254b736d2ce4590101aba66810b86716b23fcbeca7481b577c6
|
Provenance
The following attestation bundles were made for tree_scribe-0.0.3-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.3-py3-none-any.whl -
Subject digest:
ca99a1c5dfee5d6caf3319a3fb79d102e810add8797456a6b46512b4351c16d1 - Sigstore transparency entry: 153969810
- Sigstore integration time:
-
Permalink:
mamad-1999/tree-scribe@3a8a17993aa5f802205fda416ead158843a50aaf -
Branch / Tag:
refs/tags/0.0.3 - Owner: https://github.com/mamad-1999
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@3a8a17993aa5f802205fda416ead158843a50aaf -
Trigger Event:
release
-
Statement type: