bin/passrofi: Version 0.1.1

Version 0.1.1:

- Use "view_in_terminal" to view a password file if an executable with that
  name exists in the PATH.
This commit is contained in:
Lexi / Zoe 2021-12-18 19:21:45 +01:00
parent f7526687dc
commit a8456ad259
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
1 changed files with 22 additions and 2 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
# passrofi -- Rofi script for pass (passwordstore.org)
# Version: 0.1.0
# Version: 0.1.1
# Author: binaryDiv
@ -311,10 +311,25 @@ handle_view_file() {
# Open file in a pager inside a terminal
coproc (
rofi-sensible-terminal -e "bash -ic 'pass show \"$USER_SELECTION\" | less'" &>/dev/null
#rofi-sensible-terminal -e "bash -ic 'pass show \"$USER_SELECTION\" | less'" &>/dev/null
{
echo "Password file: $USER_SELECTION"
echo "------------------------------------------------------------"
pass show "$USER_SELECTION"
echo
} | view_stdin_in_terminal &>/dev/null
)
}
# Opens a terminal that shows data from stdin. Uses 'view_in_terminal' if it exists in $PATH.
view_stdin_in_terminal() {
if which view_in_terminal &>/dev/null; then
view_in_terminal
else
rofi-sensible-terminal -e "bash -ic 'less < /proc/$BASHPID/fd/0'"
fi
}
# Run script
main "$@"
@ -325,6 +340,11 @@ main "$@"
# CHANGELOG
# =========
#
# Version 0.1.1:
#
# - Use "view_in_terminal" to view a password file if an executable with that
# name exists in the PATH.
#
# Version 0.1.0:
#
# - First version