kek
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
6eb19300e1
commit
0a6f588677
14
jspass
14
jspass
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash-hammer
|
#!/usr/bin/env bash-hammer
|
||||||
|
#export IFS='\t\n'
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
require /system
|
require /system
|
||||||
|
@ -64,7 +65,7 @@ esac
|
||||||
case "${Opts[action]:-show}" in
|
case "${Opts[action]:-show}" in
|
||||||
(new) check_argn "${#@}" 1 1;
|
(new) check_argn "${#@}" 1 1;
|
||||||
vault="$1"
|
vault="$1"
|
||||||
|
|
||||||
# Check if the damn thing already exists
|
# Check if the damn thing already exists
|
||||||
vault_exists "$vault" && System.die 1 "Vault '$vault' already exists"
|
vault_exists "$vault" && System.die 1 "Vault '$vault' already exists"
|
||||||
|
|
||||||
|
@ -87,14 +88,19 @@ case "${Opts[action]:-show}" in
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(show) check_argn "${#@}" 1 2;
|
(show) check_argn "${#@}" 1;
|
||||||
vault=$1
|
vault=$1
|
||||||
field=${2:-password}
|
|
||||||
|
for i in "${@:2}"; do
|
||||||
|
items+=( -e "$i" )
|
||||||
|
done
|
||||||
|
|
||||||
|
[[ "$items" ]] || items=( -e 'password' )
|
||||||
|
|
||||||
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 "${items[@]}" -u) || {
|
||||||
System.die $? "Failed to extract json data from $vault/$field"
|
System.die $? "Failed to extract json data from $vault/$field"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user