new arg lib
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
5e3ff279e7
commit
32bd52a878
25
jspass
25
jspass
|
@ -37,14 +37,21 @@ Opts[tmp_dir]='/tmp'
|
||||||
# Default flags
|
# Default flags
|
||||||
Flags[clip]=0
|
Flags[clip]=0
|
||||||
Flags[edit]=0
|
Flags[edit]=0
|
||||||
|
Flags[pwgen]=0
|
||||||
|
|
||||||
Args "$@" -- error argv \
|
# Handle arguments
|
||||||
-l,p,"Opts[pw_len]" \
|
Args error argv "$@" << 'end'
|
||||||
-u,p,"Opts[login]" \
|
flags
|
||||||
-s,p,"Opts[selection]" \
|
-c Flags[clip]
|
||||||
-c,f,"Flags[clip]" \
|
-e Flags[edit]
|
||||||
-e,f,"Flags[edit]" \
|
-g Flags[pwgen]
|
||||||
|| { System.die "$?" "$error"; }
|
|
||||||
|
params
|
||||||
|
-l Opts[pw_len]
|
||||||
|
-u Opts[login]
|
||||||
|
-s Opts[selection]
|
||||||
|
end
|
||||||
|
(( $? )) && System.die "$?" "$error"
|
||||||
|
|
||||||
set -- "${argv[@]}"
|
set -- "${argv[@]}"
|
||||||
|
|
||||||
|
@ -64,7 +71,9 @@ case "${Opts[action]:-show}" in
|
||||||
# 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"
|
||||||
|
|
||||||
new_pass=$(pwgen "${Opts[pw_len]}" 1)
|
(( "${Flags[pwgen]}" )) && {
|
||||||
|
new_pass=$(pwgen "${Opts[pw_len]}" 1)
|
||||||
|
}
|
||||||
|
|
||||||
pass insert -m "$vault" < <(
|
pass insert -m "$vault" < <(
|
||||||
jshon -Q -n {} \
|
jshon -Q -n {} \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user