aboutsummaryrefslogtreecommitdiff
path: root/bin/menu-pass
blob: b79c19bf8794dadf72f486d23b10dd763b36e751 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
#
# Select which password from pass(1) to copy into the clipboard using an interactive menu
#
# Inspired by
# https://github.com/ibizaman/pass-clip/blob/9ef6e932e1149c07e991c82f916d018f3fbf0694/clip.bash

PASSWORD_STORE_DIR="${PASSWORD_STORE_DIR:-$HOME/.password-store}"

passfile=$(find -L "${PASSWORD_STORE_DIR}" \
               -path '*/.git' \
               -prune \
               -o \
               -iname '*.gpg' \
               -printf '%P\n' \
    | sed -e 's/.gpg$//' \
    | bemenu -i -s -c -l 20 -W 0.2 -p '*')

[ -z $passfile ] && exit 1
pass show -c $passfile