#command-line-tool #generator #tree #filesystem

app dic-structure-creater

A CLI tool that reads tree-structured text files and generates folders and files accordingly

1 unstable release

Uses new Rust 2024

new 0.1.0 Apr 21, 2025

#787 in Command line utilities

Download history 72/week @ 2025-04-16

72 downloads per month

MIT license

10KB
102 lines

DicStructureCreater

Release License Stars

DicStructureCreater is a lightweight, cross-platform CLI tool that parses directory structures from .txt or .md files and generates corresponding folders and files under a specified root directory. By default, it avoids overwriting existing files, and supports dry-run (--dry-run) and force overwrite (--overwrite) modes.


README

zh_TW

Features

  • 📁 Automatic generation: Generate folder structures and empty files from tree ASCII diagrams or Markdown-style lists.
  • 🔒 Safe by default: Existing files won't be overwritten unless explicitly allowed.
  • 🔄 Optional overwrite: Use --overwrite (-O) to force replace files.
  • 👀 Dry-run support: Use --dry-run (-d) to preview actions without changing your file system.
  • ⚙️ Cross-platform: Built with Rust, compatible with Windows, macOS, and Linux.

Installation

Using Cargo

cargo install dic-structure-creater

Download Precompiled Binary

  1. Visit the Releases page:
    https://github.com/natsuki221/DicStructureCreater/releases
  2. Download the archive for your OS, extract it, and place dsc (or dsc.exe) in your system's PATH.

Example Usage

Given a structure file structure.txt:

src/
├── lib/
│   └── utils.rs
└── main.rs
  1. Preview only (dry-run):
dsc structure.txt --dry-run
  1. Generate structure (without overwriting existing files):
dsc structure.txt
  1. Force overwrite existing files:
dsc structure.txt --overwrite

CLI Options

Option Description
STRUCTURE_FILE Path to the input structure file (required)
-r, --root <path> Root directory to create files/folders (default: .)
-O, --overwrite Overwrite existing files
-d, --dry-run Show actions without making changes
-h, --help Display help message

Supported Input Formats

DSC supports two main formats:

  1. Tree ASCII format:
src/
├── models/
│   └── user.rs
└── main.rs
  1. Markdown list format:
- src
  - models
    - user.rs
  - main.rs

Note: Lines ending with / are treated as folders; otherwise, they are considered files.


Contributing

Contributions are welcome! You can submit Issues, Pull Requests, suggestions, or bug reports.

Steps:

  1. Fork this repository
  2. Create a new branch (git checkout -b feature/your-feature)
  3. Implement your changes
  4. Submit a Pull Request

License

This project is licensed under the MIT License. See LICENSE for details.


For questions, feel free to open an issue or discussion. Happy hacking! 🚀

Dependencies

~1–1.6MB
~31K SLoC