DEVELOPMENT ENVIRONMENT

~liljamo/tamma

27aeaa85891de3c55f41fbda14455d9529e145b0 — Jonni Liljamo 28 days ago 91728b8
docs: add example
1 files changed, 34 insertions(+), 2 deletions(-)

M README.md
M README.md => README.md +34 -2
@@ 1,4 1,36 @@
# tamma

A small TUI program to run commands on a set of similar targets. Initially
created to help myself with NixOS deployments.
A small TUI program to run commands on a set of similar targets.

Initially created to aid my own NixOS deployments.

## Config

The program will read `./tamma.yaml` on start.

The config should contain two lists, `targets` and `actions`.

See the example below, but in a nutshell:
- `targets` has entries with `name` and an arbitrary structure `data`.
  - `data` can be anything you want it to be.
- `actions` has entries with `name` and a go template string `exectemplate`.
  - `exectemplate` is a template for a command to be ran in a shell, it will be
    ran with `sh -c`. The template can access `.A.target.Name` and anything in
    `.A.target.Data`.

### Example
```yaml
targets:
  - name: host1
    data:
      user: root
      host: 1.2.3.4
  - name: host2
    data:
      user: user
      host: 1.2.100.42

actions:
  - name: ssh
    exectemplate: ssh {{ .A.target.Data.user }}@{{ .A.target.Data.host }}
```