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 ./mypy_cache --ignore-list .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ファイルに書き出すパスを指定(encoding: utf-8, default: None 保存しない)
  • --help : 使い方ヘルプを表示

✨ 便利機能

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

🎉 実施例

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

mdtree --savepath 好きなパス.md

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

mdtree
├── .gitignore
├── LICENSE
├── README.md
├── mdtree
│    ├── __init__.py
│    ├── __main__.py
│    ├── test
│    │    ├── test_cli.py
│    │    └── test_structure.py
│    └── treebuilder.py
├── mdtree_output.md
├── 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 .mypy_cache --ignore-list .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 (encoding: utf-8, default: None)
  • --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 --savepath path-you-like.md

Generates a Markdown file path-you-like.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
├── mdtree_output.md
├── 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.7.tar.gz (7.3 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.7-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mdtree_py-0.1.7.tar.gz
  • Upload date:
  • Size: 7.3 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.7.tar.gz
Algorithm Hash digest
SHA256 f1b99f0c70d293cf3a25dc87118ec7e0a76cb3aa1b0931ee4f135d7d21aefac4
MD5 372cac2a412978672b25c94aaa495421
BLAKE2b-256 9a7ca5d4e0240ff4aa26636c5ca4afa53ca4ffdd01baf68a2668d3c1d2be2e7c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mdtree_py-0.1.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 001abe7b8f8bb7f654523d9954ff613ab1ad7107f30ed096e57d8ff8a6f230af
MD5 30e1eabee37a8962a518c71882323076
BLAKE2b-256 c93a0f6702d4bb55c8944979f3cbeeea097a9f09e33bb933ba1b528f2bcb755c

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