#!/usr/bin/env fish set userprofile (wslpath (cmd.exe /c echo %USERPROFILE% 2>/dev/null | string trim)) set op_base "$userprofile/AppData/Local/Microsoft/WinGet/Packages" set op_dir (ls -td "$op_base"/AgileBits.1Password.CLI* 2>/dev/null | head -n1) if test -z "$op_dir" set_color red echo "[ERROR] Could not find 1Password CLI folder in $op_base" >&2 exit 1 end set op_env_vars for var in (env | string match -r '^OP_[^=]+' | string split -f1 '=') set -a op_env_vars $var end if set -q WSLENV set -x WSLENV "$WSLENV:"(string join ':' $op_env_vars) else set -x WSLENV (string join ':' $op_env_vars) end exec $op_dir/op.exe $argv