nufmt after generation

This commit is contained in:
ari committed 2026-09-17 13:21:00 -04:00
1 parent b1c6a52503
commit e07ae98c0b
3 files changed
+57 -55

No files matched your search

+8 -8
View File
@@ -100,14 +100,14 @@
git-hooks.hooks = { git-hooks.hooks = {
# Format all .nu files with nufmt. # Format all .nu files with nufmt.
# nufmt = { nufmt = {
# enable = true; enable = true;
# name = "nufmt"; name = "nufmt";
# entry = "${pkgs.nufmt}/bin/nufmt"; entry = "${pkgs.nufmt}/bin/nufmt";
# language = "system"; language = "system";
# types = [ "file" ]; types = [ "file" ];
# files = "\\.nu$"; files = "\\.nu$";
# }; };
# Regenerate nu/completions.nu whenever a usage block changes. # Regenerate nu/completions.nu whenever a usage block changes.
gen-completions = { gen-completions = {
+47 -47
View File
@@ -8,65 +8,65 @@
# sourcing needed. # sourcing needed.
def "nu-complete hermenix top" [] { def "nu-complete hermenix top" [] {
[ [
[value description]; [value, description];
[setup "guided host-side setup"] [setup, "guided host-side setup"]
[migrate "carry an existing flat HERMES_HOME into the guest"] [migrate, "carry an existing flat HERMES_HOME into the guest"]
[remote "run setup/migrate on a remote host over SSH"] [remote, "run setup/migrate on a remote host over SSH"]
[vm "control the VM (start/stop/console/snapshots/backups)"] [vm, "control the VM (start/stop/console/snapshots/backups)"]
[ctl "drive Hermes inside the guest (identity/config/secrets/gateway)"] [ctl, "drive Hermes inside the guest (identity/config/secrets/gateway)"]
] ]
} }
def "nu-complete hermenix vm" [] { def "nu-complete hermenix vm" [] {
[ [
[value description]; [value, description];
[ssh "open a shell or run a single command in the guest"] [ssh, "open a shell or run a single command in the guest"]
[console "follow the VM's journal output (journalctl -f)"] [console, "follow the VM's journal output (journalctl -f)"]
[start "systemctl start hermes-vm"] [start, "systemctl start hermes-vm"]
[stop "systemctl stop hermes-vm"] [stop, "systemctl stop hermes-vm"]
[restart "systemctl restart hermes-vm"] [restart, "systemctl restart hermes-vm"]
[config "show current generation, history and git status"] [config, "show current generation, history and git status"]
[config-pull "copy the guest's /etc/nixos here for reading/diffing"] [config-pull, "copy the guest's /etc/nixos here for reading/diffing"]
[snapshot "trigger a state-disk snapshot now"] [snapshot, "trigger a state-disk snapshot now"]
[snapshots "list existing snapshots"] [snapshots, "list existing snapshots"]
[rollback "restore the state disk from a snapshot"] [rollback, "restore the state disk from a snapshot"]
[backup "trigger a restic backup now"] [backup, "trigger a restic backup now"]
[backups "list restic snapshots"] [backups, "list restic snapshots"]
] ]
} }
def "nu-complete hermenix ctl" [] { def "nu-complete hermenix ctl" [] {
[ [
[value description]; [value, description];
[soul "show or edit SOUL.md"] [soul, "show or edit SOUL.md"]
[memory "show or edit memories/USER.md"] [memory, "show or edit memories/USER.md"]
[conf "show or edit config.yaml"] [conf, "show or edit config.yaml"]
[secrets "manage .env (keys masked by default)"] [secrets, "manage .env (keys masked by default)"]
[status "gateway service status"] [status, "gateway service status"]
[logs "follow gateway journal (-f)"] [logs, "follow gateway journal (-f)"]
[restart "restart the gateway"] [restart, "restart the gateway"]
[units "list all hermes* user units"] [units, "list all hermes* user units"]
[reseed "overwrite identity from /etc/nixos/hermes"] [reseed, "overwrite identity from /etc/nixos/hermes"]
[pull "copy live identity back to the host"] [pull, "copy live identity back to the host"]
] ]
} }
# Context-aware completer: inspects already-typed words to decide # Context-aware completer: inspects already-typed words to decide
# whether to offer top-level subcommands or a second-level list. # whether to offer top-level subcommands or a second-level list.
def "nu-complete hermenix ctx" [context: string, offset: int] { def "nu-complete hermenix ctx" [context: string, offset: int] {
let words = $context | str trim | split row " " | where { $in != "" } let words = $context | str trim | split row " " | where { $in != "" }
match ($words | length) { match ($words | length) {
1 => (nu-complete hermenix top) 1 => (nu-complete hermenix top)
2 => { 2 => {
match ($words | get 1) { match ($words | get 1) {
"vm" => (nu-complete hermenix vm) "vm" => (nu-complete hermenix vm)
"ctl" => (nu-complete hermenix ctl) "ctl" => (nu-complete hermenix ctl)
_ => [] _ => []
} }
}
_ => []
} }
_ => []
}
} }
extern "hermenix" [...args: string@"nu-complete hermenix ctx"] extern "hermenix" [...args: string@"nu-complete hermenix ctx"]
+2
View File
@@ -143,4 +143,6 @@ if ($ctl | is-empty) { print -e "warn: no ctl completions found in ctl/ctl.nu" }
"" ""
] | str join "\n" | save -f $out_file ] | str join "\n" | save -f $out_file
nufmt $out_file
print $"wrote ($out_file) [top=($top | length) vm=($vm | length) ctl=($ctl | length)]" print $"wrote ($out_file) [top=($top | length) vm=($vm | length) ctl=($ctl | length)]"