mdirtree


Namemdirtree JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/plain-mark/mdirtree
SummaryGenerate directory structure from ASCII art or Markdown files
upload_time2024-11-24 20:37:52
maintainerNone
docs_urlNone
authorTom Sapletta
requires_python>=3.11
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements flask requests click colorama typing-extensions pyyaml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/plain-mark/mdirtree",
    "name": "mdirtree",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": null,
    "author": "Tom Sapletta",
    "author_email": "Tom Sapletta <info@softreck.dev>",
    "download_url": "https://files.pythonhosted.org/packages/94/f5/6735302c1d06090da7421eb7c1852c3906d836647f0ab471cf5f51232161/mdirtree-0.1.1.tar.gz",
    "platform": null,
    "description": "# mdirtree\n\nGenerate directory structures from ASCII art or Markdown files.\n\n+ [CONTRIBUTION.md](CONTRIBUTION.md)\n\n## Installation\n\n\n### Setting up a virtual environment\n\nCreate a virtual environment\n\n```bash\npython -m venv venv\n```\n\n```bash\nsource venv/bin/activate\n```\n\n```bash\npip install --upgrade pip\npip install -r requirements.txt\n```\n\n```bash\npip install -e .\n```\n\n\n## Usage\n\n```bash\n# Generate from Markdown file\nmdirtree structure.md -o ./output_dir\n\n# Generate from text file\nmdirtree structure.txt -o ./output_dir\n\n# Generate from stdin\nmdirtree - -o ./output_dir\n\n# Dry run (show planned operations without creating files)\nmdirtree --dry-run structure.md\n```\n\n### Input Format Example\n\n```\nproject/\n\u251c\u2500\u2500 src/\n\u2502   \u251c\u2500\u2500 main.py\n\u2502   \u2514\u2500\u2500 utils/\n\u2514\u2500\u2500 tests/\n    \u2514\u2500\u2500 test_main.py\n```\n\n\n## REST API\n\nmdirtree oferuje r\u00f3wnie\u017c REST API do generowania struktur katalog\u00f3w:\n\n### Uruchomienie serwera\n\n```python\nfrom mdirtree.rest.server import run_server\n\nrun_server(host='0.0.0.0', port=5000)\n```\n\n### U\u017cycie klienta\n\n```python\nfrom mdirtree.rest.client import MdirtreeClient\n\nclient = MdirtreeClient('http://localhost:5000')\n\nstructure = \"\"\"\nproject/\n\u251c\u2500\u2500 src/\n\u2502   \u2514\u2500\u2500 main.py\n\u2514\u2500\u2500 tests/\n    \u2514\u2500\u2500 test_main.py\n\"\"\"\n\n# Generowanie struktury\nresult = client.generate_structure(structure, output_path=\"./output\")\nprint(result)\n\n# Tryb dry run\nresult = client.generate_structure(structure, dry_run=True)\nprint(result)\n```\n\n### REST API Endpoints\n\n- POST /generate\n  - Request body:\n    ```json\n    {\n        \"structure\": \"ASCII art structure\",\n        \"output_path\": \"optional output path\",\n        \"dry_run\": false\n    }\n    ```\n  - Response:\n    ```json\n    {\n        \"status\": \"success\",\n        \"operations\": [\"list of operations\"],\n        \"output_path\": \"output path\"\n    }\n    ```\n    \n## Features\n\n- Generate directory structure from ASCII tree diagrams\n- Support for Markdown and text files\n- Interactive input mode\n- Dry run mode\n- Comment support (using # after file/directory names)\n- Special handling for common files (README.md, __init__.py, etc.)\n\n## License\n\n[LICENSE](LICENSE)\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Generate directory structure from ASCII art or Markdown files",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/plain-mark/mdirtree"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ea94582a13f0c9fbe1a3718f2baf61746c63fa0a1d9d61e4578622a8c8633d1",
                "md5": "acf1decd7fb42e248132900b8574c92e",
                "sha256": "bd8ed2a3ca89538e349e7e1488730d32a4046cf32a19c94723dfb8df2473c91a"
            },
            "downloads": -1,
            "filename": "mdirtree-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "acf1decd7fb42e248132900b8574c92e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 11576,
            "upload_time": "2024-11-24T20:37:49",
            "upload_time_iso_8601": "2024-11-24T20:37:49.856270Z",
            "url": "https://files.pythonhosted.org/packages/0e/a9/4582a13f0c9fbe1a3718f2baf61746c63fa0a1d9d61e4578622a8c8633d1/mdirtree-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "94f56735302c1d06090da7421eb7c1852c3906d836647f0ab471cf5f51232161",
                "md5": "64360998b220de6e0324c2f2e2c3d33a",
                "sha256": "91dcd9e7397eb23c7c755abbf574e4f9b98e7f23198f59c4acb45c1b6280ab96"
            },
            "downloads": -1,
            "filename": "mdirtree-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "64360998b220de6e0324c2f2e2c3d33a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 1141500,
            "upload_time": "2024-11-24T20:37:52",
            "upload_time_iso_8601": "2024-11-24T20:37:52.938289Z",
            "url": "https://files.pythonhosted.org/packages/94/f5/6735302c1d06090da7421eb7c1852c3906d836647f0ab471cf5f51232161/mdirtree-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-24 20:37:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "plain-mark",
    "github_project": "mdirtree",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "flask",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.25.0"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    ">=",
                    "8.0.0"
                ]
            ]
        },
        {
            "name": "colorama",
            "specs": [
                [
                    ">=",
                    "0.4.4"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    ">=",
                    "4.0.0"
                ]
            ]
        },
        {
            "name": "pyyaml",
            "specs": [
                [
                    ">=",
                    "5.4.1"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "mdirtree"
}
        
Elapsed time: 0.31460s