Files
hermenix/nu/completions.nu
2026-09-17 13:21:00 -04:00

73 lines
2.6 KiB
Nu

# Tab-completion definitions for hermenix.
#
# !! GENERATED — do not edit by hand.
# !! Regenerate with: nu nu/gen-completions.nu
#
# Installed to $out/share/nushell/vendor/autoload/ so nushell on NixOS
# picks them up automatically from environment.systemPackages. No manual
# sourcing needed.
def "nu-complete hermenix top" [] {
[
[value, description];
[setup, "guided host-side setup"]
[migrate, "carry an existing flat HERMES_HOME into the guest"]
[remote, "run setup/migrate on a remote host over SSH"]
[vm, "control the VM (start/stop/console/snapshots/backups)"]
[ctl, "drive Hermes inside the guest (identity/config/secrets/gateway)"]
]
}
def "nu-complete hermenix vm" [] {
[
[value, description];
[ssh, "open a shell or run a single command in the guest"]
[console, "follow the VM's journal output (journalctl -f)"]
[start, "systemctl start hermes-vm"]
[stop, "systemctl stop hermes-vm"]
[restart, "systemctl restart hermes-vm"]
[config, "show current generation, history and git status"]
[config-pull, "copy the guest's /etc/nixos here for reading/diffing"]
[snapshot, "trigger a state-disk snapshot now"]
[snapshots, "list existing snapshots"]
[rollback, "restore the state disk from a snapshot"]
[backup, "trigger a restic backup now"]
[backups, "list restic snapshots"]
]
}
def "nu-complete hermenix ctl" [] {
[
[value, description];
[soul, "show or edit SOUL.md"]
[memory, "show or edit memories/USER.md"]
[conf, "show or edit config.yaml"]
[secrets, "manage .env (keys masked by default)"]
[status, "gateway service status"]
[logs, "follow gateway journal (-f)"]
[restart, "restart the gateway"]
[units, "list all hermes* user units"]
[reseed, "overwrite identity from /etc/nixos/hermes"]
[pull, "copy live identity back to the host"]
]
}
# Context-aware completer: inspects already-typed words to decide
# whether to offer top-level subcommands or a second-level list.
def "nu-complete hermenix ctx" [context: string, offset: int] {
let words = $context | str trim | split row " " | where { $in != "" }
match ($words | length) {
1 => (nu-complete hermenix top)
2 => {
match ($words | get 1) {
"vm" => (nu-complete hermenix vm)
"ctl" => (nu-complete hermenix ctl)
_ => []
}
}
_ => []
}
}
extern "hermenix" [...args: string@"nu-complete hermenix ctx"]