Skip to main content

A CLI tool to visualize directory structures as Markdown or Mermaid diagrams

Project description

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!

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

directory_visualizer-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

directory_visualizer-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file directory_visualizer-0.1.0.tar.gz.

File metadata

  • Download URL: directory_visualizer-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for directory_visualizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d091e517684c6d62e9aab8019232fba80578e2c48aebb807959a676b05ac6e1
MD5 c4ada5db4e45decafb876103249986cf
BLAKE2b-256 6614a7e38cac4d9532e676a259ed5f591e1d2f5bfc5ce6fdee683e18d35d430c

See more details on using hashes here.

File details

Details for the file directory_visualizer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for directory_visualizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79501eac6522798e48e3524430c70b1962adff91bcd9a12a17c5ae225d1730cb
MD5 9f50ceaa53498c3eb0d270de9ee1a8f0
BLAKE2b-256 98c3c096370397e4a4388a90f31b5bc4e372986c0e17fb8cbfe3c0e92bc39cbf

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