aboutsummaryrefslogtreecommitdiffhomepage
path: root/X11/rofi/pass.rm
blob: a4077927ca9848b8eefcfc03df2d0d1630e72ca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /bin/sh

ENTRIES="$(find ~/.password-store -name '*gpg' -printf %P\\n | sed 's/.gpg$//')"

# Give rofi available passwords and exit
if [ $# -eq 0 ]; then
	# Specify rofi prompt as 'Remove'
	echo -e "\0prompt\x1fRemove"

	echo "$ENTRIES"
	exit 0
fi

# If password doesn't exist, just quit
<<<"$ENTRIES" grep -q $1 && \
	coproc ( 
		pass rm $1 &>/dev/null && \
		rofi -e "Removed: $1"  || \
		rofi -e "Fail to remove $1"
	)