new arg lib

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2017-04-21 02:10:35 +03:00
parent 5e3ff279e7
commit 32bd52a878

23
jspass
View File

@ -37,14 +37,21 @@ Opts[tmp_dir]='/tmp'
# Default flags
Flags[clip]=0
Flags[edit]=0
Flags[pwgen]=0
Args "$@" -- error argv \
-l,p,"Opts[pw_len]" \
-u,p,"Opts[login]" \
-s,p,"Opts[selection]" \
-c,f,"Flags[clip]" \
-e,f,"Flags[edit]" \
|| { System.die "$?" "$error"; }
# Handle arguments
Args error argv "$@" << 'end'
flags
-c Flags[clip]
-e Flags[edit]
-g Flags[pwgen]
params
-l Opts[pw_len]
-u Opts[login]
-s Opts[selection]
end
(( $? )) && System.die "$?" "$error"
set -- "${argv[@]}"
@ -64,7 +71,9 @@ case "${Opts[action]:-show}" in
# Check if the damn thing already exists
vault_exists "$vault" && System.die 1 "Vault '$vault' already exists"
(( "${Flags[pwgen]}" )) && {
new_pass=$(pwgen "${Opts[pw_len]}" 1)
}
pass insert -m "$vault" < <(
jshon -Q -n {} \