Skip to main content

Output directory structure as Markdown code block

Project description

mdtree

See below for the English version.

Source code available on GitHub! 👥


🔄 これは何?

mdtree は、指定したディレクトリ構造を、テキストベースのMarkdownファイルとして出力するCLIツールです。

「作ったディレクトリ構造をサクッと分かりやすく紹介したい」「プロジェクトの構成を手間なく見せたい」そんな時に使えます。


🔍 使い方

インストール

pip install mdtree-py

コマンド例

現在のディレクトリを観測:

mdtree

他のオプション例:

mdtree --path ./your_project --max-depth 2 --ignore-list node_modules .venv --no-clipboard --savepath structure.md

主なオプション

  • --path [PATH] : 構造を取りたいディレクトリパス指定(default: .
  • --max-depth [N] : 探索する最大階層を指定
  • --ignore-list [PATTERN] : 除外したいパターンを複数指定(gitignore形式)
  • --apply-gitignore / --no-apply-gitignore : .gitignore設定に基づく除外を適用/適用しない(default: 適用する)
  • --exclude-git / --no-exclude-git : .gitディレクトリを除外する/しない(default: 除外する)
  • --clipboard / --no-clipboard : 出力をクリップボードにコピーする/しない(default: コピーする)
  • --savepath [FILE] : Markdownファイルに書き出すパスを指定(default: tree.md
  • --help : 使い方ヘルプを表示

✨ 便利機能

  • .gitignoreに基づいた除外も自動適用可能
  • .gitディレクトリもデフォルトで除外
  • クリップボードへ結果を即コピペ可能
  • Markdownファイルへキレイに書き出し

🎉 実施例

例えばこのリポジトリのルートで以下のように実行すると・・・

mdtree --ignore-list .DS_Store

こんな感じのコードブロックを持ったmdファイルがmdtree/tree.mdに生成されます。 また、コードブロック内のテキストがクリップボードに追加されます。

mdtree
├── .gitignore
├── LICENSE
├── README.md
├── mdtree
|    ├── __init__.py
|    ├── __main__.py
|    ├── test
|    |    ├── test_cli.py
|    |    └── test_structure.py
|    └── treebuilder.py
├── pyproject.toml
└── requirements.txt

💛 ライセンス

This project is licensed under the terms of the MIT license.


Source code available on GitHub! 👥


🔄 What is this?

mdtree is a CLI tool that outputs the structure of a specified directory as a text-based Markdown file.

It's perfect for situations where you want to quickly show your directory structure or easily explain the layout of your project.


🔍 How to use

Installation

pip install mdtree-py

Example command

Check the current directory structure:

mdtree

Other options:

mdtree --path ./your_project --max-depth 2 --ignore-list node_modules .venv --no-clipboard --savepath structure.md

Main options

  • --path [PATH] : Specify the directory path to inspect (default: .)
  • --max-depth [N] : Set the maximum depth for traversal
  • --ignore-list [PATTERN] : Specify patterns to ignore (multiple allowed, gitignore format)
  • --apply-gitignore / --no-apply-gitignore : Apply or ignore .gitignore settings (default: apply)
  • --exclude-git / --no-exclude-git : Exclude or include the .git directory (default: exclude)
  • --clipboard / --no-clipboard : Copy output to clipboard or not (default: copy)
  • --savepath [FILE] : Path to save output as a Markdown file (default: tree.md)
  • --help : Display help

✨ Features

  • Automatically apply .gitignore-based exclusions
  • Exclude .git directory by default
  • Instantly copy results to clipboard
  • Cleanly export results as a Markdown file

🎉 Example

For example, running the following command at the root of this repository:

mdtree --ignore-list .DS_Store

Generates a Markdown file mdtree/tree.md containing a code block like this, and also copies the block to your clipboard:

mdtree
├── .gitignore
├── LICENSE
├── README.md
├── mdtree
|    ├── __init__.py
|    ├── __main__.py
|    ├── test
|    |    ├── test_cli.py
|    |    └── test_structure.py
|    └── treebuilder.py
├── pyproject.toml
└── requirements.txt

💛 License

This project is licensed under the terms of the MIT license.

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

mdtree_py-0.1.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

mdtree_py-0.1.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file mdtree_py-0.1.2.tar.gz.

File metadata

  • Download URL: mdtree_py-0.1.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for mdtree_py-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9b20b29850e8683d662d7be7ac15c82a489a63cdfd0e4698a34f762f9bf4e318
MD5 3f92b27f5d663a630ab9a85dae343c26
BLAKE2b-256 b833306c9e7ca46e0f6eca6ca6a2d8395e0029951b3152f95a8a1adbc7fe1f0f

See more details on using hashes here.

File details

Details for the file mdtree_py-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mdtree_py-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for mdtree_py-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7bed28b7e44191f102dd0c4fc7a91cc007daa59c2a1d914222977294e27302eb
MD5 6d414cf41dee4e29dab356ba777b07a9
BLAKE2b-256 42ce1457dfdbbeb166aae49c517c187ed94447175dd452b6b240dc76d4c9d82f

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