Generate directory structure from ASCII art or Markdown files
Project description
mdirtree
Generate directory structures from ASCII art or Markdown files.
Installation
Setting up a virtual environment
Create a virtual environment
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
Usage
# Generate from Markdown file
mdirtree structure.md -o ./output_dir
# Generate from text file
mdirtree structure.txt -o ./output_dir
# Generate from stdin
mdirtree - -o ./output_dir
# Dry run (show planned operations without creating files)
mdirtree --dry-run structure.md
Input Format Example
project/
├── src/
│ ├── main.py
│ └── utils/
└── tests/
└── test_main.py
REST API
mdirtree oferuje również REST API do generowania struktur katalogów:
Uruchomienie serwera
from mdirtree.rest.server import run_server
run_server(host='0.0.0.0', port=5000)
Użycie klienta
from mdirtree.rest.client import MdirtreeClient
client = MdirtreeClient('http://localhost:5000')
structure = """
project/
├── src/
│ └── main.py
└── tests/
└── test_main.py
"""
# Generowanie struktury
result = client.generate_structure(structure, output_path="./output")
print(result)
# Tryb dry run
result = client.generate_structure(structure, dry_run=True)
print(result)
REST API Endpoints
- POST /generate
- Request body:
{ "structure": "ASCII art structure", "output_path": "optional output path", "dry_run": false }
- Response:
{ "status": "success", "operations": ["list of operations"], "output_path": "output path" }
- Request body:
Features
- Generate directory structure from ASCII tree diagrams
- Support for Markdown and text files
- Interactive input mode
- Dry run mode
- Comment support (using # after file/directory names)
- Special handling for common files (README.md, init.py, etc.)
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
mdirtree-0.1.1.tar.gz
(1.1 MB
view details)
Built Distribution
mdirtree-0.1.1-py3-none-any.whl
(11.6 kB
view details)
File details
Details for the file mdirtree-0.1.1.tar.gz
.
File metadata
- Download URL: mdirtree-0.1.1.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91dcd9e7397eb23c7c755abbf574e4f9b98e7f23198f59c4acb45c1b6280ab96 |
|
MD5 | 64360998b220de6e0324c2f2e2c3d33a |
|
BLAKE2b-256 | 94f56735302c1d06090da7421eb7c1852c3906d836647f0ab471cf5f51232161 |
File details
Details for the file mdirtree-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: mdirtree-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd8ed2a3ca89538e349e7e1488730d32a4046cf32a19c94723dfb8df2473c91a |
|
MD5 | acf1decd7fb42e248132900b8574c92e |
|
BLAKE2b-256 | 0ea94582a13f0c9fbe1a3718f2baf61746c63fa0a1d9d61e4578622a8c8633d1 |