Metadata-Version: 2.2
Name: touch-struct
Version: 0.1.0
Summary: A tool to create directory and file structures from text representations like the ones you might get from ChatGPT.
Author-email: Jade Glaze <jade.glaze@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Jade Glaze
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE. 
Project-URL: Homepage, https://github.com/jadeglaze/touch-struct
Project-URL: Bug Tracker, https://github.com/jadeglaze/touch-struct/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0.0
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Requires-Dist: pytest-cov>=4.0.0; extra == "test"

# touch-struct

A tool to create directory and file structures from text representations like the ones you might get from ChatGPT.

## Installation

You can install via pip:

```bash
pip install touch-struct
```

## Usage

`touch-struct` can be used both as a command-line tool and as a Python library.

### Command Line Usage

The most convenient (but maybe not obvious) way to use `touch-struct` may be to paste the structure directly into your terminal like this:

1. Copy the structure you want to create into your clipboard. (Usually from ChatGPT or similar)
2. In your terminal, go to the directory you want to create the structure in.
3. Type `touch-struct -` (the dash is important!) and hit enter.
4. Paste the structure into the terminal.
5. Press Ctrl+D (which means "end of file") to finish.
6. Voila! The structure is created!

There are however a few other ways to use it:

```bash
# Create from a file
touch-struct structure.txt

# Create in a specific directory
touch-struct structure.txt --output-dir my-new-project

# Create from stdin (pipe)
cat structure.txt | touch-struct -
```

### Python Library Usage

```python
import touch_struct

# Create from a string
structure = """
project/
├── src/
│   ├── main.py
│   └── utils.py
├── tests/
│   └── test_main.py
├── README.md
└── setup.py
"""
touch_struct.from_string(structure)

# Create from a file
touch_struct.from_file("structure.txt")

# Create in a specific directory
touch_struct.from_string(structure, base_path="my-new-project")
touch_struct.from_file("structure.txt", base_path="my-new-project")
```

## Structure Format

The tool accepts a text representation of directory structures using ASCII characters:
- Use `/` at the end of a line to indicate directories
- Use standard ASCII characters (`├`, `│`, `└`, `─`) to draw the tree structure
- Indentation and structure characters are used to determine hierarchy

Example structure file:
```
my-project/
├── src/
│   ├── main.py
│   └── utils.py
├── tests/
│   └── test_main.py
└── docs/
    ├── index.md
    └── api.md
```

You can also create multiple root directories or files:
```
README.md
LICENSE
frontend/
├── src/
│   └── app.js
└── package.json
backend/
├── src/
│   └── server.py
└── requirements.txt
```

### Tips
- Files shouldn't have a trailing slash: `README.md`
- Directories need a trailing slash: `src/`
- Spaces in names are supported: `My Project/`
- You can mix files and directories at any level
- The structure can be as deep as you need
- Root level can contain multiple files and directories

## Contributing

For detailed information about contributing, including how to make releases, please see [CONTRIBUTING.md](CONTRIBUTING.md).

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. 
