My dotfiles
1#!/usr/bin/env fish
2
3set userprofile (wslpath (cmd.exe /c echo %USERPROFILE% 2>/dev/null | string trim))
4set op_base "$userprofile/AppData/Local/Microsoft/WinGet/Packages"
5set op_dir (ls -td "$op_base"/AgileBits.1Password.CLI* 2>/dev/null | head -n1)
6
7if test -z "$op_dir"
8 set_color red
9 echo "[ERROR] Could not find 1Password CLI folder in $op_base" >&2
10 exit 1
11end
12
13set op_env_vars
14for var in (env | string match -r '^OP_[^=]+' | string split -f1 '=')
15 set -a op_env_vars $var
16end
17
18if set -q WSLENV
19 set -x WSLENV "$WSLENV:"(string join ':' $op_env_vars)
20else
21 set -x WSLENV (string join ':' $op_env_vars)
22end
23
24exec $op_dir/op.exe $argv