fix(fish): use --in-file for op inject to fix stdin issue in command substitution

This commit is contained in:
2026-04-13 20:13:38 +08:00
parent 067608f4f8
commit 3c6910cfb1
3 changed files with 5 additions and 3 deletions
-1
View File
@@ -1,6 +1,5 @@
{ {
inputs, inputs,
lib,
username, username,
pkgs, pkgs,
... ...
+4 -2
View File
@@ -64,12 +64,14 @@ in
source ~/.config/fish/local.fish source ~/.config/fish/local.fish
end end
# 1Password env vars (single op call, silent if locked) # 1Password env vars (single op call, silent on failure)
function op-env --description "Load secrets from 1Password" function op-env --description "Load secrets from 1Password"
if not type -q op; or not test -f ${envTpl} if not type -q op; or not test -f ${envTpl}
return 1 return 1
end end
for line in (op inject < ${envTpl} 2>/dev/null) set -l output (op inject --in-file ${envTpl} 2>/dev/null)
or return 1
for line in $output
string match -qr '^\s*(#|$)' -- $line; and continue string match -qr '^\s*(#|$)' -- $line; and continue
set -l kv (string split -m 1 '=' $line) set -l kv (string split -m 1 '=' $line)
if test (count $kv) -ge 2 if test (count $kv) -ge 2
+1
View File
@@ -86,6 +86,7 @@
"raycast" "raycast"
"spotify" "spotify"
"telegram-desktop" "telegram-desktop"
"tencent-meeting"
"termius" "termius"
"visual-studio-code" "visual-studio-code"
"wechat" "wechat"