some fixes

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2017-04-26 14:41:02 +03:00
parent 32bd52a878
commit 6eb19300e1

13
jspass
View File

@ -34,11 +34,6 @@ Opts[selection]="${X_SELECTION:-clipboard}"
Opts[store]="$HOME/.password-store" Opts[store]="$HOME/.password-store"
Opts[tmp_dir]='/tmp' Opts[tmp_dir]='/tmp'
# Default flags
Flags[clip]=0
Flags[edit]=0
Flags[pwgen]=0
# Handle arguments # Handle arguments
Args error argv "$@" << 'end' Args error argv "$@" << 'end'
flags flags
@ -61,7 +56,9 @@ case "$1" in
shift shift
;; ;;
(cp|edit|git|grep|help|init|insert|ls|mv|rm) exec pass "$@";; (cp|edit|git|grep|help|init|insert|ls|mv|rm)
exec pass "$@"
;;
esac esac
case "${Opts[action]:-show}" in case "${Opts[action]:-show}" in
@ -97,7 +94,9 @@ case "${Opts[action]:-show}" in
vault_exists "$vault" || System.die 1 "Vault does not exist: $1" vault_exists "$vault" || System.die 1 "Vault does not exist: $1"
if vault_is_json "$vault"; then if vault_is_json "$vault"; then
pass=$(pass "$vault" | jshon -e "$field" -u) pass=$(pass "$vault" | jshon -e "$field" -u) || {
System.die $? "Failed to extract json data from $vault/$field"
}
else else
[[ "$2" ]] && err "Warning: ignoring '$field', because '$vault' is not a json vault" [[ "$2" ]] && err "Warning: ignoring '$field', because '$vault' is not a json vault"