Create directory and file structures from tree-like text representations
Project description
以下は、アップロードされた core.py、setup.py を基に作成した README.md の内容です。
📁 Tree Creator
🌐 言語: English version | 日本語はこちら
Create directory and file structures from tree-like text representations — just like the output of the tree command.
✨ Features
- Parse text-based tree structures and generate corresponding directories and files.
- Dry-run support (simulate without creating files).
- CLI and API support.
- Helpful logging for debugging and auditing.
- Zero external dependencies.
📦 Installation
pip install tree-creator
or (for development)
git clone https://github.com/jack-low/tree-creator
cd tree-creator
pip install -e ".[dev]"
🚀 Usage
✨ Example (Python API)
from tree_creator import TreeCreator
tree_text = '''
project/
├── src/
│ ├── main.py
│ └── utils.py
└── README.md
'''
creator = TreeCreator()
creator.create_from_text(tree_text, base_dir='./my_project')
💻 CLI
🧪 Example using Here Document (EOF)
You can also provide multi-line tree structure input via standard input like this:
tree-creator -b ./output-dir -d - <<EOF
myapp/
├── index.html
└── static/
└── style.css
EOF
-denables dry-run mode (no files will actually be created)-b ./output-dirspecifies the target directory-means the input is read from stdin
tree-creator tree.txt --base-dir ./my_project
tree-creator tree.txt --dry-run
echo "dir/\n└── file.txt" | tree-creator -
Options
| Option | Description |
|---|---|
-b, --base-dir |
Target base directory (default: .) |
-e, --encoding |
Encoding for input file (default: utf-8) |
-d, --dry-run |
Simulate without file creation |
-v, --verbose |
Verbose log output |
📄 Tree Format
A valid tree structure should follow the conventions similar to the tree command output:
project/
├── src/
│ ├── main.py
│ └── utils.py
└── README.md
- Directories end with
/ - Indentation and characters:
├──,└──,│
🧪 Development
Run tests with:
pytest
Code formatting and checks:
black .
flake8 .
mypy tree_creator
📜 License
MIT License © Jack3Low
🔗 Links
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tree_creator-1.0.0.tar.gz.
File metadata
- Download URL: tree_creator-1.0.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6a4d742f7c2faeace89f864e95993dd8ec88897074fa4d8b251f3f5a1a6be05
|
|
| MD5 |
1e1d6b5b7738c0e91ec46e5f0e4386a9
|
|
| BLAKE2b-256 |
3af2fcf3d561b44c60008090afcee59e5c156f11a1904e7118a8e8ff2aa42904
|
File details
Details for the file tree_creator-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tree_creator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8360a310166a369f48fd1542eade32299a373e35c4719a492ecd9db5213c606
|
|
| MD5 |
a3bfc6f2cd2b40da48b51944a6f5bc45
|
|
| BLAKE2b-256 |
4276b4e269bb3154b75fba465877bd91886a6098647a51f83d72a546d6a529e0
|