Browse Source

new arg lib

Signed-off-by: fbt <fbt@fleshless.org>
master
Jack L. Frost 5 years ago
parent
commit
32bd52a878
1 changed files with 18 additions and 9 deletions
  1. +18
    -9
      jspass

+ 18
- 9
jspass View File

@ -37,14 +37,21 @@ Opts[tmp_dir]='/tmp'
# Default flags
Flags[clip]=0
Flags[edit]=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"; }
Flags[pwgen]=0
# 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"
new_pass=$(pwgen "${Opts[pw_len]}" 1)
(( "${Flags[pwgen]}" )) && {
new_pass=$(pwgen "${Opts[pw_len]}" 1)
}
pass insert -m "$vault" < <(
jshon -Q -n {} \


Loading…
Cancel
Save