Skip to main content

Directory Visualizer

A simple CLI tool to visualize directory structures as Markdown or Mermaid diagrams. This tool can help you quickly document the folder structure of any directory in a human-readable format or generate a Mermaid diagram for visual representation.

Features

  • Directory Structure Visualization: Create an easily readable Markdown file that represents the directory structure.
  • Mermaid Diagram Generation: Generate a Mermaid diagram to visualize the directory structure as a flowchart.
  • CLI Tool: Run the tool from the command line with various options for customization, such as setting the depth of traversal or choosing the output format.

Installation

To install directory-visualizer, you can use pip:

pip install directory-visualizer

Usage

Once installed, you can use the command line interface (CLI) to visualize any directory.

Basic Command

To generate a directory structure in Markdown format:

directory-visualizer -p <path_to_directory> -f markdown

This will create a directory_structure.md file in the current working directory.

Generate Mermaid Diagram

To generate a Mermaid diagram (embedded in Markdown):

directory-visualizer -p <path_to_directory> -f mermaid

This will create a directory_structure.md file with the Mermaid diagram.

Generate Raw Mermaid File

If you prefer to save the diagram as a raw .mmd file, use the --raw-mermaid flag:

directory-visualizer -p <path_to_directory> -f mermaid --raw-mermaid

This will create a directory_structure.mmd file that can be rendered using Mermaid live editors or other Mermaid-supported tools.

Set Directory Traversal Depth

You can limit the depth of directory traversal using the --depth option. For example, to visualize only the first two levels of a directory structure:

directory-visualizer -p <path_to_directory> -f markdown --depth 2

Output to Specific File

Use the -o option to specify a custom output file name:

directory-visualizer -p <path_to_directory> -f markdown -o custom_output.md

Example

To visualize the directory structure of E:\files\Directory_Visualizer\directory-visualizer in Markdown format with a depth of 3:

directory-visualizer -p E:\files\Directory_Visualizer\directory-visualizer -f markdown --depth 3

This will generate a directory_structure.md file with the directory structure up to level 3.

Options

  • -p, --path <directory>: Path to the directory to visualize.
  • -f, --format <format>: Output format (markdown, mermaid). Default is markdown.
  • -o, --output <file>: Output file path to save the visualization.
  • --depth <depth>: Limit the directory traversal depth.
  • --raw-mermaid: Save the Mermaid diagram as a raw .mmd file (instead of Markdown).

Example Output

Markdown Example

# Directory Structure of E:\files\Directory_Visualizer\directory-visualizer

- # directory-visualizer
  - LICENSE
  - MANIFEST.in
  - README.md
  - setup.py
  - ## tests
    - test_visualizer.py
    - __init__.py
  - ## visualizer
    - custom_output.md
    - directory_structure.md
    - visualizer.py
    - __init__.py

Mermaid Example

graph TD
  directory-visualizer[(directory-visualizer)]
  directory-visualizer --> LICENSE
  directory-visualizer --> MANIFEST.in
  directory-visualizer --> README.md
  directory-visualizer --> setup.py
  directory-visualizer --> tests[(tests)]
  tests --> test_visualizer.py
  tests --> __init__.py
  directory-visualizer --> visualizer[(visualizer)]
  visualizer --> custom_output.md
  visualizer --> directory_structure.md
  visualizer --> visualizer.py
  visualizer --> __init__.py

Contributing

If you would like to contribute to this project, please fork the repository, create a new branch, and submit a pull request. All contributions are welcome!

Steps to Contribute:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature-name.
  3. Make your changes.
  4. Commit your changes: git commit -am 'Add new feature'.
  5. Push to your forked branch: git push origin feature-name.
  6. Open a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Md. Rasel Meya

Acknowledgements

  • Thanks to all the contributors who helped improve this project.
  • Special thanks to the open-source community for their valuable contributions.

Points to Note:

  1. Features section: Briefly explains what your tool does.
  2. Installation and Usage: Guides the user on how to install and use the tool with examples of common commands.
  3. Example Output: Shows what the output looks like for both markdown and mermaid formats.
  4. Contributing: Instructions for contributing to the project.
  5. License: Specifies the project's licensing (MIT, in this case).
  6. Acknowledgements: Recognizes contributors and open-source support.

This README file should provide users with all the necessary information to get started with your directory-visualizer project. You can always modify the details as you see fit. Let me know if you'd like any adjustments!

Metadata

Release files for directory-visualizer 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for directory-visualizer 0.1.0
File Size Uploaded
directory_visualizer-0.1.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for directory-visualizer 0.1.0
File Interpreter ABI Platform
directory_visualizer-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / directory_visualizer-0.1.0.tar.gz

Download URL directory_visualizer-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9d091e517684c6d62e9aab8019232fba80578e2c48aebb807959a676b05ac6e1
BLAKE2b-256 checksum
How to use checksums
6614a7e38cac4d9532e676a259ed5f591e1d2f5bfc5ce6fdee683e18d35d430c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.13.0

Release files / directory_visualizer-0.1.0-py3-none-any.whl

Download URL directory_visualizer-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79501eac6522798e48e3524430c70b1962adff91bcd9a12a17c5ae225d1730cb
BLAKE2b-256 checksum
How to use checksums
98c3c096370397e4a4388a90f31b5bc4e372986c0e17fb8cbfe3c0e92bc39cbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.13.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page