diff options
Diffstat (limited to 'bin/secretmenu')
| -rwxr-xr-x | bin/secretmenu | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/bin/secretmenu b/bin/secretmenu index 0ba9754..386d870 100755 --- a/bin/secretmenu +++ b/bin/secretmenu @@ -8,15 +8,13 @@ trap '{ notify-send -a secretmenu -i "${ico}" -c error "secretmenu: failed :(" " secretmgr=rbw printpass= -first= -while getopts bpP1h name; do +while getopts bpPh name; do case ${name} in b) secretmgr=rbw ;; p) secretmgr=pass ;; P) printpass=1 ;; - 1) first=1 ;; h | ?) - echo "usage: secretmenu [-bp] [-P] [-1] [query]" + echo "usage: secretmenu [-bp] [-P] [query]" echo exit 2 ;; @@ -26,10 +24,10 @@ shift $((OPTIND - 1)) if [ "$secretmgr" = "rbw" ] && command -v rbw >/dev/null 2>&1; then __list_secrets() { - rbw list --fields user,name | tr '\t' '@' + rbw list --fields name,user,id | column -t -s $'\t' } __query_secret() { - rbw get --full $(awk -F@ '{print $2 " " $1}' <<<"$1") 2>&1 + rbw get --full -- "${1##* }" 2>&1 } fi if [ "$secretmgr" = "pass" ] && command -v pass >/dev/null 2>&1; then @@ -70,15 +68,11 @@ done # fi __menu() { - if [ -n "$first" ]; then - grep "$@" | head -n1 - return - fi if [ -t 1 ]; then echo "terminal mode not implemented" exit 1 fi - MENU_PROMPT=" secret" menu --accept-single ${@:+--filter "$@"} + MENU_PROMPT=" secret" menu --list=10 --accept-single ${@:+--filter "$@"} } pw=$({ |