add ZPASS_PRIORITIZE_CLI feature

This commit is contained in:
zawz 2021-10-08 18:09:26 +02:00
parent f62750cdbc
commit ac7bbae78a
2 changed files with 6 additions and 1 deletions

View file

@ -43,6 +43,7 @@ usage()
ZPASS_SSH_ID SSH private key to use for scp/sftp
ZPASS_REMOTE_USER User for login
ZPASS_REMOTE_PASSWORD Password for ftps/webdav login. Not for SSH
ZPASS_PRIORITIZE_CLI Key prompt will always be done on CLI if stdin is a tty
All operations can be shortened to their first char unless specified
Unknown first argument will perform the operation described in 'ZPASS_UNK_OP_CALL' on that argument

View file

@ -15,9 +15,13 @@ console_prompt_hidden()
)
}
is_graphical() {
[ -n "$DISPLAY" ] && { [ -z "$ZPASS_PRIORITIZE_CLI" ] || ! [ -t 0 ] ; }
}
# $1 = prompt message
prompt_password() {
if [ -n "$DISPLAY" ]
if is_graphical
then
if which kdialog >/dev/null 2>&2
then kdialog --title "$fname" --password "$1" 2>/dev/null