Files
dots/common/.config/fish/functions/kp.fish
T
2026-09-17 20:45:06 +02:00

17 lines
609 B
Fish

function kp
if not set -q KP_DB
echo "Error: KP_DB environment variable is not set. Check ~/.config/fish/conf.d/secrets.fish"
return 1
end
read -s -P "Enter db password: " pass
echo ""
# -f flattens to full paths; without it nested entries are printed indented and
# without their group prefix, so `clip` can't find them. Group lines end in "/".
set -l entry (printf '%s\n' $pass | keepassxc-cli ls -q -R -f $KP_DB | string match -v '*/' | fzf | string trim)
if test -n "$entry"
printf '%s\n' $pass | keepassxc-cli clip -q $KP_DB $entry 0
end
end