duck-template 0.1.1

A cli tool for generating files from a template just with a json file
# ๐Ÿฆ† duck-template

> A fast, customizable CLI tool for scaffolding project templates from structured JSON configurations.

`duck-template` lets you define reusable project templates in JSON and generate boilerplate code with ease using a simple, flexible command-line interface.

---

## โœจ Features

- ๐Ÿงฑ **Template-based project scaffolding**
- โš™๏ธ **Powerful `init` and `create` commands**
- ๐Ÿ“ฆ **JSON-based configuration support**
- ๐Ÿชถ **Written in Rust โ€” lightweight and blazing fast**
- ๐Ÿ’ฌ **Helpful logging and error messages**

---

## ๐Ÿ“ฆ Installation

```bash
cargo install duck-template
````

---

## ๐Ÿš€ Usage

### Initialize a new project

```bash
duck-template init --name my-app
```

This will:

* Read your `duck-template.json` config
* Create a new output folder with the structure defined in the template
* Inject any CLI-provided values (e.g. `--name`) into the template

### Create a variant from your config

```bash
duck-template create --variant api
```

This will:

* Select a template variant defined in your config file
* Generate the corresponding output structure

---

## ๐Ÿงฉ Configuration

The CLI expects a JSON config file like this:

```json
{
  "$schema": "https://zpgqhogoevbgpxustvmo.supabase.co/storage/v1/object/public/json/duck-template-schema.json",
  "name": "my-template",
  "version": "0.1.0",
  "description": "A customizable web app starter template.",
  "outdir": "./output",
  "variants": [
    {
      "name": "api",
      "description": "Basic Express API setup",
      "files": [
        { "path": "src/index.ts", "content": "console.log('API running');" },
        { "path": "tsconfig.json", "template": "tsconfig-template.json" }
      ]
    }
  ]
}
```

You can define:

* `variants`: groups of files or folders
* `outdir`: where the output should be created
* `template`: reuse external files and inject dynamic variables

---

## ๐Ÿงช Example

```bash
duck-template init --name wiseman
```

```json
// duck-template.json
{
  "name": "wiseman",
  "outdir": "./output",
  "variants": [
    {
      "name": "wiseman",
      "files": [
        { "path": "src/main.ts", "content": "console.log('{{name}} is wise');" }
      ]
    }
  ]
}
```

Results in:

```
output/
โ””โ”€โ”€ src/
    โ””โ”€โ”€ main.ts // => console.log("wiseman is wise");
```

---

## ๐Ÿ›  Commands

| Command   | Description                             |
| --------- | --------------------------------------- |
| `init`    | Initializes a new template project      |
| `create`  | Generates output from a defined variant |
| `help`    | Shows the help menu                     |
| `version` | Prints the CLI version                  |

---

## ๐Ÿ” License

Licensed under either of:

* MIT License
* Apache License, Version 2.0

---

## ๐Ÿ’ฌ Feedback / Contributions

Feel free to open issues, request features, or contribute via pull requests.

---

> ๐Ÿฆ† **duck-template** โ€” because smart devs don't start from scratch every time.