From 27aeaa85891de3c55f41fbda14455d9529e145b0 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Sat, 3 May 2025 13:03:44 +0300 Subject: [PATCH] docs: add example --- README.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3c448c6..df38a36 100644 --- a/README.md +++ b/README.md @@ -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 }} +``` -- 2.44.1