summaryrefslogtreecommitdiff
path: root/passmenu/passmenu
diff options
context:
space:
mode:
Diffstat (limited to 'passmenu/passmenu')
-rwxr-xr-xpassmenu/passmenu141
1 files changed, 0 insertions, 141 deletions
diff --git a/passmenu/passmenu b/passmenu/passmenu
deleted file mode 100755
index eee435d..0000000
--- a/passmenu/passmenu
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/bin/sh
-
-# !!!! UPDATE WITH ROFI GOODNESS
-
-###
-# passmenu - dmenu interface for password-store
-#
-# The popular, commonly used script for this purpose is available at
-# <https://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu>
-# (as of 2019-05-20).
-# However, that script has been written in bash. This is my own, pure sh
-# implementation. I believe it is slower and a lot less efficient. Nevertheless,
-# it just works(TM). It is also tailored to my own liking.
-#
-# The script requires the following binaries in PATH to work:
-# - pass (password-store, obviously)
-# - dmenu (also rather obvious)
-# - xsel (for the ability to copy the username only)
-#
-# The script has a manual included, but for the sake of redundancy, the options
-# are also listed below. It accepts all options dmenu accepts and uses them as
-# expected.
-#
-# SYNOPSIS: passmenu [-hu] [dmenu options]
-# -h, --help print usage
-# -u, --username copy the username, not the password
-#
-# bertalanp99@ 2019-05-20
-###
-
-#################
-### FUNCTIONS ###
-#################
-
-usage()
-{
- printf 'usage: passmenu [-hu]'
-}
-
-
-#################
-### VARIABLES ###
-#################
-
-prefix=${PASSWORD_STORE_DIR-$HOME/.password-store/}
-
-
-##############
-### SCRIPT ###
-##############
-
-### CHECK FOR BINARIES IN PATH ###
-
-for binary in pass dmenu xsel
-do
- if ! command -v $binary >/dev/null 2>&1
- then
- echo "this script needs '$binary' in PATH to work"
- exit 1
- fi
-done
-
-### PARSE OPTIONS ###
-
-needuser=0
-dmenuoptions=
-while [ -n "$1" ]
-do
- case $1 in
- -b|-f|-i|-v)
- dmenuoptions="$dmenuoptions $1"
- ;;
-
- -l|-m|-p|-fn|-nb|-nf|-sb|-sf|-w)
- dmenuoptions="$dmenuoptions $1 $2"
- shift
- ;;
-
- -c)
- cli=1
- ;;
-
- -h)
- usage
- exit 0
- ;;
-
- -u)
- needuser=1
- ;;
-
- *)
- echo "unknown option -- $1"
- usage
- exit 1
- ;;
- esac
- shift
-done
-
-### MAIN ###
-
-
-if [ -n "$cli" ]
-then
- password="$(\
- find "$prefix" -name '*.gpg' \
- | sed "s|${prefix}\(.*\).gpg|\1|" \
- | fzf)"
- if [ $needuser -eq 0 ]
- then
- pass show "$password" 2>/dev/null \
- | sed 1q \
- | tr -d '\n' \
- | xsel --input
- else
- pass show "$password" 2>/dev/null \
- | awk '/login:/{print $2}' \
- | tr -d '\n' \
- | xsel --input
- fi
- return
-fi
-
-password="$(\
- find "$prefix" -name '*.gpg' \
- | sed "s|${prefix}\(.*\).gpg|\1|" \
- | rofi -dmenu $dmenuoptions)"
-
-if [ $needuser -eq 0 ]
-then
- pass show "$password" 2>/dev/null \
- | sed 1q \
- | tr -d '\n' \
- | xsel --input
-else
- pass show "$password" 2>/dev/null \
- | awk '/login:/{print $2}' \
- | tr -d '\n' \
- | xsel --input
-fi