fzpass: Add linewrapping in preview
This commit is contained in:
parent
1de4b0a771
commit
29ca84ab0c
1 changed files with 24 additions and 24 deletions
|
@ -6,10 +6,11 @@ prefix=${PASSWORD_STORE_DIR:=~/.password-store}
|
|||
|
||||
## Get all the gpg files in all directories and subdirs...
|
||||
## remove the prefix, some 3 extra chars and the .gpg ending
|
||||
password_files=$( find $prefix -name '*.gpg' \
|
||||
| cut --characters ${#prefix}- \
|
||||
| cut --characters 3- \
|
||||
| rev | cut --characters 5- | rev
|
||||
password_files=$(
|
||||
find $prefix -name '*.gpg' |
|
||||
cut --characters ${#prefix}- |
|
||||
cut --characters 3- |
|
||||
rev | cut --characters 5- | rev
|
||||
)
|
||||
|
||||
## Some functions to call from inside the fzf menu
|
||||
|
@ -23,27 +24,26 @@ fzpass_update () {
|
|||
}
|
||||
export -f fzpass_update
|
||||
|
||||
|
||||
## Send the filelist to fzf,
|
||||
## disable the fzf mouse to use the primary selection
|
||||
password=$( printf '%s\n' "${password_files[@]}" \
|
||||
| fzf --bind='ctrl-s:toggle-preview' \
|
||||
password=$(
|
||||
printf '%s\n' "${password_files[@]}" |
|
||||
fzf --bind='ctrl-s:toggle-preview' \
|
||||
--bind='ctrl-u:execute(fzpass_update)' \
|
||||
--bind='ctrl-r:execute(pass rm {})' \
|
||||
--bind='ctrl-e:execute(pass edit {} < /dev/tty > /dev/tty)' \
|
||||
--preview='pass show {}' \
|
||||
--preview-window="hidden" \
|
||||
--preview-window="up,30%,hidden,wrap" \
|
||||
--no-mouse \
|
||||
--header='
|
||||
Ret: Copy pass, show OTP; C-s: Show entry; C-e: Edit entry
|
||||
C-u: Update (pull, push); C-r: Remove'
|
||||
$@ \
|
||||
$@
|
||||
)
|
||||
|
||||
## Exit if nothing was selected
|
||||
test "_$password" = "_" && exit
|
||||
|
||||
|
||||
## Copy pass and show otp, exit silently if anything fails
|
||||
pass show -c "$password"
|
||||
pass otp "$password" 2>/dev/null || exit 0
|
||||
|
|
Loading…
Reference in a new issue