-
Notifications
You must be signed in to change notification settings - Fork 0
Automations
Two mechanisms run on top of an SSH session: macros (manual, on demand) and expect rules (auto-fire on output).
Global automations live in ~/.config/gukab/automations.toml; a host may also
carry its own under [[hosts.macros]] / [[hosts.expects]].
A macro has a key (typed in the picker) and a send payload. Mid-session,
Ctrl+A opens the fuzzy macro picker (Ctrl+A Ctrl+A sends a literal
Ctrl+A). Results are ranked by relevance, same as the host list.
[[macros]]
key = "en"
send = "enable"A send may be multi-line (TOML triple-quoted) — each non-empty line is sent
as its own Enter-terminated command:
[[macros]]
key = "port-access"
send = """
configure terminal
interface range Gi1/0/1 - 24
switchport mode access
end
"""When pattern (a regex) appears in the session output, gukab auto-sends a
response: either send (literal) or the keychain password named by
send_credential. once = true fires at most once per session.
[[macros.expects]]
pattern = "[Pp]assword:"
send_credential = "enable" # keychain entry; store with Ctrl+K
once = falseA rule must set exactly one of send / send_credential. Credentials are read
from the keychain at match time, never stored in config.
A host's on_connect = ["en"] auto-runs those macros right after connecting, and
arms that macro's expect rules for the session.
-
Macros (global or per-host) are always available for manual
Ctrl+Ause; they never auto-fire. - A macro's
expectsarm only when that macro runs viaon_connect. - A host's own
[[hosts.expects]]always apply.
So the en macro can own the [Pp]assword: → enable-secret rule, and it only
applies to hosts that actually run en; a plain in-band-login switch (no
on_connect) gets no auto-answers.