Skip to main content

Output directory structure as Markdown code block

Project description

mdtree

See below for the English version.


🔄 これは何?

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

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


🔍 使い方

インストール

pip install mdtree

コマンド例

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

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.


🔄 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

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.0.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.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mdtree_py-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 cfe6d740f8d10d462adf56f828f137f7e94b598ac2ce3323241627530c0dfaf6
MD5 f1ce4ff1ff0928ee27742462900dcf04
BLAKE2b-256 540e4ec80236ac025cf597d4397cecf85f6c743be269328c89047baa1729d396

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mdtree_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7be80d5c1d6e297ba3d3ca32d726bcefdc7c6e16ea14118c89993b36e1800c00
MD5 617af40d5e8a2b3696dabe72f1d7d7a0
BLAKE2b-256 93d46961ba4ba842a73991e55d2280be67f72ddab2ba9105cd808c719f65e0cf

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