From 09463d0dbb7da7c33499a35d562912b221fe72ca Mon Sep 17 00:00:00 2001 From: imbytecat Date: Mon, 13 Apr 2026 15:46:19 +0800 Subject: [PATCH] refactor(fish): extract op-env into reloadable function and skip comment lines --- home/shell/fish.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/home/shell/fish.nix b/home/shell/fish.nix index 41de126..4260f0a 100644 --- a/home/shell/fish.nix +++ b/home/shell/fish.nix @@ -61,14 +61,19 @@ end # 1Password → env vars (single op call, silent if locked) - if type -q op; and test -f ~/.config/op/env.tpl + function op-env --description "Load secrets from 1Password" + if not type -q op; or not test -f ~/.config/op/env.tpl + return 1 + end for line in (op inject < ~/.config/op/env.tpl 2>/dev/null) + string match -qr '^\s*(#|$)' -- $line; and continue set -l kv (string split -m 1 '=' $line) if test (count $kv) -ge 2 set -gx $kv[1] $kv[2] end end end + op-env ''; }; }