From 9822f7425a913fc11792dfe42ace626212d1e46f Mon Sep 17 00:00:00 2001 From: Amolith Date: Wed, 3 Dec 2025 12:47:37 -0700 Subject: [PATCH] feat(fish): support fish functions in opx Assisted-by: Kimi K2 Thinking via Crush --- dot_config/private_fish/functions/opx.fish | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dot_config/private_fish/functions/opx.fish b/dot_config/private_fish/functions/opx.fish index e7cf1ad1f5352d6912b3c6c2ceb9a8ce10f2b73d..ed0ffd37401541f0b14c9cbcd5b677fe753ddbb9 100644 --- a/dot_config/private_fish/functions/opx.fish +++ b/dot_config/private_fish/functions/opx.fish @@ -28,5 +28,26 @@ function opx --description "Run command with 1Password secret refs resolved" return 1 end - env $resolved_lines $argv + # Check if the command is a fish function + if functions -q $argv[1] + # Parse resolved values (originals are in $refs) + set -l resolved_values + for line in $resolved_lines + set -a resolved_values (string split -m1 '=' $line)[2] + end + # Set globals with resolved values + for i in (seq (count $vars_to_resolve)) + set -gx $vars_to_resolve[$i] $resolved_values[$i] + end + # Run command + $argv + set -l cmd_status $status + # Restore original op:// refs + for i in (seq (count $vars_to_resolve)) + set -gx $vars_to_resolve[$i] $refs[$i] + end + return $cmd_status + else + env $resolved_lines $argv + end end