Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Structure Generator

A simple tool to create a project structure (folders and files) from a given yaml structure. (vibe-coded)

Features

  • 🏗️ Create complex directory structures from simple text files
  • 📁 Support for nested folders and files
  • 🔍 Dry-run mode to preview changes
  • 🎯 Customizable output directory
  • 📝 YAML-like syntax that's easy to read and write
  • ⚡ Fast and lightweight

Installation

From Source

git clone <repository-url>
cd file-structure-generator
nim c -d:release src/structgen.nim

Using Nimble

nimble install

Usage

Basic Usage

structgen my_structure.yaml

Advanced Usage

# Create structure in specific directory
structgen -o /path/to/output my_structure.yaml

# Dry run to see what would be created
structgen --dry-run my_structure.yaml

# Verbose output
structgen --verbose my_structure.yaml

Command Line Options

  • -h, --help: Show help message
  • -o, --output DIR: Specify output directory (default: current directory)
  • -d, --dry-run: Preview what would be created without actually creating
  • -v, --verbose: Enable verbose output

File Format

The tool uses a YAML-like syntax:

  • Directories: End with a colon :
  • Files: Start with a dash and space -
  • Indentation: Use 2 spaces for each level (consistent indentation required)

Example Structure File

my_project:
  src:
    - main.nim
    - config.nim
    utils:
      - helper.nim
      - parser.nim
  bin:
    - app_executable
  tests:
    - test_main.nim
    - test_utils.nim
  docs:
    assets:
      - logo.png
    - README.md
  empty_folder:
  - LICENSE
  - .gitignore

This creates:

my_project/
├── src/
│   ├── main.nim
│   ├── config.nim
│   └── utils/
│       ├── helper.nim
│       └── parser.nim
├── bin/
│   └── app_executable
├── tests/
│   ├── test_main.nim
│   └── test_utils.nim
├── docs/
│   ├── assets/
│   │   └── logo.png
│   └── README.md
├── empty_folder/
├── LICENSE
└── .gitignore

Examples

Simple Web Project

my_website:
  public:
    css:
      - styles.css
    js:
      - main.js
    - index.html
  src:
    - server.nim
  - README.md

Nim Library Project

my_lib:
  src:
    my_lib:
      - core.nim
      - utils.nim
    - my_lib.nim
  tests:
    - test_core.nim
    - test_utils.nim
  examples:
    - basic_usage.nim
  docs:
    - api.md
  - README.md
  - my_lib.nimble
  - .gitignore

Empty Directories

To create empty directories, simply specify the directory name with a colon and no children:

project:
  empty_dir:
  another_empty:
  - some_file.txt

Error Handling

The tool provides clear error messages for common issues:

  • File not found: When the input file doesn't exist
  • Parse errors: When the YAML-like syntax is invalid
  • Permission errors: When unable to create files/directories
  • Invalid paths: When specified paths are invalid

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Development

Building

nim c src/structgen.nim

Running Tests

nim c -r tests/test_all.nim

Creating Release

nim c -d:release --opt:size src/structgen.nim

License

MIT License - see LICENSE file for details.

About

A simple tool to create a project structure (folders and files) from a given yaml structure. (vibe-coded)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages