Skip to main content

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

-d

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

Examples

  1. Display the Directory Structure

    tree-scribe /home/project
    
  2. Export to Markdown

    tree-scribe /home/project --export-md
    
  3. Limit Depth to 2 Levels

    tree-scribe /home/project --depth 2
    
  4. Enable Verbose Logging

    tree-scribe /home/project --verbose
    
  5. Enable Colorful Output

    tree-scribe /home/project -c
    
  6. Show line and size

    tree-scribe /home/project -s
    
  7. Combine Options

    tree-scribe /home/project --export-md --depth 3 -c -s
    

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

tree_scribe-0.0.5.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

tree_scribe-0.0.5-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file tree_scribe-0.0.5.tar.gz.

File metadata

  • Download URL: tree_scribe-0.0.5.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tree_scribe-0.0.5.tar.gz
Algorithm Hash digest
SHA256 2fb85ce98665c6d58804ef5e2594cdc9386a29b3389d8c4f7cf7e6892a4ed20c
MD5 395645be274b38aa0f03d00dfc507578
BLAKE2b-256 1a754e0b5c27e9cc447849f6698794bfae926eacca3fe78a7413d2bb4dd73e91

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_scribe-0.0.5.tar.gz:

Publisher: main.yml on mamad-1999/tree-scribe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_scribe-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: tree_scribe-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tree_scribe-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d6611ddbc01006e34ee9d72a24103b43d7a4bbc5bd59ad8dc409e48cc45ef5d4
MD5 8b5b7ca650f91307aa47ff1d41c6f257
BLAKE2b-256 f6cd17cb22af469390beeb4493f75d83efafb7242d826260e6c44de30d9dd530

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_scribe-0.0.5-py3-none-any.whl:

Publisher: main.yml on mamad-1999/tree-scribe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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