Metadata-Version: 2.1
Name: mdirtree
Version: 0.1.1
Summary: Generate directory structure from ASCII art or Markdown files
Home-page: https://github.com/plain-mark/mdirtree
Author: Tom Sapletta
Author-email: Tom Sapletta <info@softreck.dev>
License: Apache-2.0
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: flask>=2.0.0
Requires-Dist: requests>=2.25.0
Requires-Dist: click>=8.0.0
Requires-Dist: colorama>=0.4.4
Requires-Dist: typing-extensions>=4.0.0
Requires-Dist: pyyaml>=5.4.1
Provides-Extra: dev
Requires-Dist: pytest>=6.0.0; extra == "dev"
Requires-Dist: pytest-cov>=2.0.0; extra == "dev"
Requires-Dist: pytest-mock>=3.6.1; extra == "dev"
Requires-Dist: black>=21.5b2; extra == "dev"
Requires-Dist: flake8>=3.9.2; extra == "dev"
Requires-Dist: mypy>=0.910; extra == "dev"
Requires-Dist: isort>=5.9.3; extra == "dev"
Requires-Dist: pre-commit>=2.15.0; extra == "dev"
Requires-Dist: tox>=4.11.3; extra == "dev"
Requires-Dist: twine>=3.4.2; extra == "dev"
Requires-Dist: build>=0.7.0; extra == "dev"
Requires-Dist: gitpython>=3.1.0; extra == "dev"

# mdirtree

Generate directory structures from ASCII art or Markdown files.

+ [CONTRIBUTION.md](CONTRIBUTION.md)

## Installation


### Setting up a virtual environment

Create a virtual environment

```bash
python -m venv venv
```

```bash
source venv/bin/activate
```

```bash
pip install --upgrade pip
pip install -r requirements.txt
```

```bash
pip install -e .
```


## Usage

```bash
# 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

```python
from mdirtree.rest.server import run_server

run_server(host='0.0.0.0', port=5000)
```

### Użycie klienta

```python
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:
    ```json
    {
        "structure": "ASCII art structure",
        "output_path": "optional output path",
        "dry_run": false
    }
    ```
  - Response:
    ```json
    {
        "status": "success",
        "operations": ["list of operations"],
        "output_path": "output path"
    }
    ```
    
## 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

[LICENSE](LICENSE)
