dotfiles/.local/bin/rofi-pass
2019-11-04 10:57:55 +01:00

36 lines
771 B
Fish
Executable File

#!/usr/bin/env fish
for arg in $argv
switch $arg
case '--type'
set -g TYPE "yes"
case '-t'
set -g TYPE "yes"
case 'type'
set -g TYPE "yes"
case '*'
printf 'Unknown argument: %s\n.' $arg
exit 1
end
end
set passwords (find $HOME/.password-store -type f -name "*.gpg" | \
string replace -r ".*.password-store/" "" | \
string replace -r ".gpg" "" | sort)
set password (for elem in $passwords
echo $elem
end | rofi -dmenu -i -p "Select your password")
if test -z $password
exit
end
if test $TYPE = "yes"
set -l IFS
set pass (pass show $password | string split -n \n)[1]
printf %s $pass | xvkbd -file -
else
pass show -c $password 2> /dev/null
end