Generated | ||
src | ||
Tasks | ||
Templates | ||
.gitignore | ||
LICENSE | ||
README.md |
What?
Verkos: (Esperanto) will compose
Verkos will compose your shell snippets into functional monolithic setup scripts!
Build
Deps:
nim, nimble
cd src
nimble install yaml
make build
Usage:
Verkos arguments
Generate a Verkos Template:
verkos new template Templates/example.yaml
Generate a Task Template:
verkos new task pkgs
Generate a script from a template:
verkos compose Templates/something.yaml
Writing a Task
Here's a simple example, really you just need a task to be a simple shell function.
pkgs() {
apk add $1
}
You can source and use that snippet like this:
Script: Generated/example.sh
Shell: '#!/bin/ash'
Variables:
Tasks:
- Path: Tasks/apk_pkgs
Invo: 'pkgs "emacs htop tmux"'
And the resulting script should come out like this:
#!/bin/ash
pkgs() {
apk add $1
}
pkgs "emacs htop tmux"
You can also include variables in your tasks. The same task could look like this:
pkgs() {
apk add $packages
}
In your template file you'd then need to provide a variable with your packages:
Script: Generated/example.sh
Shell: '#!/bin/ash'
Variables:
- Name: packages
Value: "emacs htop tmux"
Tasks:
- Path: Tasks/apk_pkgs
Invo: apk_pkgs
And the resulting script should come out like this:
#!/bin/ash
packages="emacs htop tmux"
pkgs() {
apk add $packages
}
pkgs
A very simple difference, but intermingling these two paradigms allows you to build either reusable tasks you can import ubiquitously, or more complicated tasks you can provide flexible configuration for easily.
TODO
- Some sort of lint/checker for the template & task files?
- A variable checker, so if a task has a $var that isn't defined it warns during generation
- Vault style secret substitutions, or post generation modifier