mks

Crates.iomks
lib.rsmks
version0.1.8
created_at2025-12-09 10:59:48.069776+00
updated_at2026-01-13 18:25:17.909549+00
descriptionPaste tree from clipboard
homepagehttps://github.com/cumulus13/mks
repositoryhttps://github.com/cumulus13/mks
max_upload_size
id1975302
size31,912
cumulus13 (cumulus13)

documentation

https://docs.rs/mks

README

mks – Create Directory Structures from Tree-like Text

mks is a lightweight, cross-platform CLI tool that reads a directory structure in tree format (from clipboard or file) and automatically creates the corresponding folders and files.

Perfect for quickly scaffolding projects from shared diagrams, documentation, or terminal output.


🎦 Demo

How to use mks - tree2 -pt
Demo

βœ… Features

  • Input from clipboard or text file
  • Supports Unix-style tree output (with β”œβ”€β”€, └──, β”‚)
  • Also supports simple indented format using spaces or tabs
  • Windows-safe: validates file/folder names (blocks CON, NUL, invalid chars)
  • Creates empty files and nested directories as specified
  • Fast, dependency-light, and compiles to a single executable

πŸš€ Quick Start

0. Install

cargo install mks

βœ… Format A: Simple Indent (Recommended)

Use spaces or tabs for nesting (no special symbols needed):

my-app/
    package.json
    src/
        index.js
        utils/
            helper.js
    public/
        style.css

βœ… Format B: tree Output (Unix-style)

Copy directly from tree command in Git Bash, WSL, or Linux/macOS:

my-app/
β”œβ”€β”€ package.json
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.js
β”‚   └── utils/
β”‚       └── helper.js
└── public/
    └── style.css

3. Run mks

From a file:

mks structure.txt

From clipboard:

# Copy your tree text, then run:
mks

βœ… Output:

Read from file (7 lines)
βœ… Creating structure...
βœ… Done!

πŸ“ Output Example

Given this input:

blog/
    posts/
        first.md
    config.yaml

mks will create:

blog/
β”œβ”€β”€ config.yaml
└── posts/
    └── first.md

All files are empty (0 bytes) β€” ideal for scaffolding.


⚠️ Limitations & Notes

  • Windows reserved names (CON, PRN, AUX, NUL, COM1, LPT1, etc.) are blocked.
  • Filenames cannot contain: < > : " / \ | ? *
  • Filenames cannot end with space or dot (.)
  • Maximum filename length: 255 characters
  • On Linux, ensure xclip or xsel is installed for clipboard support:
    sudo apt install xclip    # Debian/Ubuntu
    

πŸ”’ Safety First

mks never overwrites existing files.
If a file or folder already exists, it is skipped silently (no error).

To start fresh, run mks in an empty directory.


πŸ› οΈ Build Your Own

cargo build --release  # As per your preference for executable name
cp target/release/mks /usr/local/bin

The tool uses the MIT License β€” free to use, modify, and distribute.


πŸ’‘ Pro Tips

  • Use Git Bash on Windows to generate valid tree output:
    tree my-project
    
  • Prefer space-indented format if sharing across teams β€” it’s more portable.
  • Combine with templates: generate structure β†’ fill files later.

πŸ™Œ Author

Hadi Cahyadi

Buy Me a Coffee

Donate via Ko-fi

Support me on Patreon


β€œScaffold fast, code faster.” β€” mks

Commit count: 9

cargo fmt