2023-05-14 17:24:43 +00:00
|
|
|
#!/bin/sh
|
2021-11-21 21:52:45 +00:00
|
|
|
|
|
|
|
if [[ -z "$@" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
# Return a regular expression that should trigger
|
|
|
|
# this subcommand. q.sh will then pass control to
|
|
|
|
# this script whenever the input line matches.
|
|
|
|
echo "^p .*$"
|
2021-11-21 21:52:45 +00:00
|
|
|
elif [[ "$1" == "--hint" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
# This subcommand has no hints
|
|
|
|
shift
|
2021-11-21 21:52:45 +00:00
|
|
|
elif [[ "$1" == "--complete" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
shift
|
|
|
|
# Return a list of all accounts for which we store
|
|
|
|
# passwords. This will be used to provide a list of
|
|
|
|
# completions.
|
|
|
|
cd ~/.password-store
|
2024-11-03 23:36:22 +00:00
|
|
|
find . -name "*.gpg" | sed -E 's/\.\/(.*)\.gpg/\1 p \1/'
|
2021-11-21 21:52:45 +00:00
|
|
|
elif [[ "$1" == "--preview" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
shift
|
|
|
|
# This information will be displayed in the preview
|
|
|
|
# pane on the right.
|
|
|
|
echo "Will get password for $1"
|
2021-11-21 21:52:45 +00:00
|
|
|
elif [[ "$1" == "--run" ]]; then
|
2024-11-03 01:59:02 +00:00
|
|
|
shift
|
|
|
|
# This will be triggered when enter is pressed on
|
|
|
|
# one of the options. We now decrypt the password
|
|
|
|
# and place it to the clipboard.
|
2024-11-20 07:08:16 +00:00
|
|
|
NAME="$2"
|
2024-11-03 23:36:22 +00:00
|
|
|
pass "$NAME" | (setsid -f wl-copy)
|
2021-11-21 21:52:45 +00:00
|
|
|
fi
|