A simple scaffold tool written in Rust. Skelly helps you quickly set up new project structures or generate files from templates.
- Project Scaffolding: Generate entire project structures from a skeleton directory.
- Single File Rendering: Render individual template files.
- Standard Input/Output: Process templates from standard input and write to standard output.
- Flexible Inputs: Pass custom key-value inputs to templates.
- Input Validation: Define required inputs and options in
skelly.toml. - Tera Templating: Utilizes the Tera templating engine for powerful template syntax.
You can install skelly using cargo:
cargo install --git https://github.com/emersonmx/skellyTo scaffold a new project from a skeleton directory (e.g., my-skeleton/):
skelly \
--skeleton-path my-skeleton \
--output-path my-new-project \
build_tool=cargo target_path=distThis command will:
- Look for
skelly.tomlinsidemy-skeleton/. - Read the templates from
my-skeleton/skeleton/. - Process all files and directories within
my-skeleton/skeleton/, rendering their content and filenames using the provided inputs. - Write the rendered output to
my-new-project/.
If output-path is omitted, the current directory (.) is used.
To print the scaffolded project to stdout:
skelly \
--skeleton-path my-skeleton \
build_tool=cargo target_path=dist > project.txtTo render a single file using skelly:
skelly --file-path template.txt name=WorldThis will render template.txt using the name=World input and print the
result to standard output.
You can pipe content to skelly to render it:
echo "Hello {{ name }}!" | skelly name=AliceThis will output Hello Alice! to standard output.
Inputs are passed as KEY=value pairs after other arguments. These inputs are
used to fill in placeholders in your templates.
skelly ... my_key="my value" another_key=123skelly -v --file-path template.txtWhen scaffolding a project using --skeleton-path, skelly expects a
skelly.toml file inside the specified directory. This file defines the inputs
your skeleton expects and configures the template directory.
Example skelly.toml:
[[inputs]]
name = "build_tool"
options = ["rustc", "cargo"]
default = "cargo"
[[inputs]]
name = "target_path"
default = "target"template_directory: (Implicitly handled, defaults to askeletonsubdirectory inside the skeleton path).inputs: An array of input definitions.name: The name of the input (e.g.,build_tool).options: An optional list of allowed values for the input. If provided,skellywill validate the user-provided input against these options. Ifoptionsis an empty list, any value is accepted.default: An optional default value for the input. If the user doesn't provide this input, the default value will be used. Integers, booleans, and other types provided asdefaultwill be converted to strings.
The actual template files and directories should be placed in a subdirectory
named skeleton (by default) within your skeleton path. For example, if your
skeleton path is my-project-template/, your templates would reside in
my-project-template/skeleton/.
Skelly uses the Tera for rendering. You can use standard Tera syntax for variables, loops, conditionals, etc., within your template files and even in the names of your files and directories.
Example src/main.rs template:
fn main() {
println!("Hello, {{ name }}!");
}When rendering with name=World, the output will be Hello, World!.
Skelly is licensed under the MIT License. See the LICENSE file for more
details.