Update pass
This commit is contained in:
45
pass
45
pass
@@ -6,7 +6,6 @@ export GPG_TTY=$(tty)
|
||||
|
||||
GPG_ID="acidvegas" # change me
|
||||
GPG_OPTS="-q --yes --compress-algo=none --no-encrypt-to --batch"
|
||||
METHOD="type"
|
||||
PASS_DIR=$HOME/.secrets
|
||||
|
||||
if [ -z $EDITOR ]; then
|
||||
@@ -51,33 +50,6 @@ generate() {
|
||||
esac
|
||||
}
|
||||
|
||||
menu() {
|
||||
cwd=$PASS_DIR
|
||||
while :
|
||||
do
|
||||
if [ $cwd = $PASS_DIR ]; then
|
||||
cmd=$(ls -p $cwd | sed 's/\.gpg$//' | dmenu -l 5 "$@")
|
||||
else
|
||||
cmd=$({ echo ".."; ls -p $cwd | sed 's/\.gpg$//'; } | dmenu -l 5 "$@")
|
||||
fi
|
||||
if [ -z $cmd ]; then
|
||||
break
|
||||
elif [ $cmd = '..' ]; then
|
||||
cwd=$(dirname $cwd)
|
||||
elif [ -d $cwd/$cmd ]; then
|
||||
cwd=$cwd/$cmd
|
||||
elif [ -f $cwd/$cmd ]; then
|
||||
if [ $METHOD = "copy" ]; then
|
||||
PINENTRY_USER_DATA="dmenu" gpg -d $GPG_OPTS $cwd/$cmd | dmenu "$@" | xclip -selection clipboard
|
||||
sleep 3 && xclip -selection clipboard /dev/null
|
||||
elif [ $METHOD = "type" ]; then
|
||||
PINENTRY_USER_DATA="dmenu" gpg -d $GPG_OPTS $cwd/$cmd | dmenu "$@" | xdotool type --delay 3 "$D"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
otp() {
|
||||
if [ -f $PASS_DIR/$1.gpg ]; then
|
||||
otp_uri=$(gpg -d $GPG_OPTS $PASS_DIR/$1.gpg | tail -n 1) || exit 1
|
||||
@@ -107,22 +79,7 @@ show() {
|
||||
command -v gpg >/dev/null || { echo "error: missing required package 'gpg'"; exit 1; }
|
||||
command -v tree >/dev/null || { echo "error: missing required package 'tree'"; exit 1; }
|
||||
if [ "$#" = '1' ]; then
|
||||
if [ $1 = 'menu' ]; then
|
||||
command -v dmenu >/dev/null || { echo "error: missing required package 'dmenu'"; exit 1; }
|
||||
command -v pinentry >/dev/null || { echo "error: missing required package 'pinentry'"; exit 1; }
|
||||
command -v pinentry-dmenu >/dev/null || { echo "error: missing required package 'pinentry-dmenu'"; exit 1; }
|
||||
if [ $METHOD = "copy" ]; then
|
||||
command -v xclip >/dev/null || { echo "error: missing required package 'xclip'"; exit 1; }
|
||||
elif [ $METHOD = 'type' ]; then
|
||||
command -v xdotool >/dev/null || { echo "error: missing required package 'xdotool'"; exit 1; }
|
||||
else
|
||||
echo "error: invalid menu method (must be 'copy' or 'type')"
|
||||
exit 1
|
||||
fi
|
||||
menu
|
||||
else
|
||||
show $1
|
||||
fi
|
||||
show $1
|
||||
elif [ "$#" = '2' ]; then
|
||||
if [ "$1" = 'edit' ]; then
|
||||
edit $2
|
||||
|
||||
Reference in New Issue
Block a user