Skip to content

Commit

Permalink
Merge pull request drwetter#1401 from drwetter/catch_someuser_errors
Browse files Browse the repository at this point in the history
Catch user error using --json/--html and friends
  • Loading branch information
drwetter authored Dec 2, 2019
2 parents 58cfe12 + 4c1bee1 commit 10fc141
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions testssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19448,6 +19448,9 @@ parse_cmd_line() {
--json)
"$do_pretty_json" && fatal "flat and pretty JSON output are mutually exclusive" $ERR_CMDLINE
"$do_json" && fatal "--json and --jsonfile are mutually exclusive" $ERR_CMDLINE
if [[ "$2" =~ \.(json|JSON)$ ]]; then
fatal "No file name allowed after \"--json\" (use \"--jsonfile\" instead)" $ERR_CMDLINE
fi
do_json=true
;; # DEFINITION of JSONFILE is not arg specified: automagically in parse_hn_port()
# following does the same but additionally we can specify a log location
Expand All @@ -19461,6 +19464,9 @@ parse_cmd_line() {
--json-pretty)
"$do_json" && fatal "flat and pretty JSON output are mutually exclusive" $ERR_CMDLINE
"$do_pretty_json" && fatal "--json-pretty and --jsonfile-pretty are mutually exclusive" $ERR_CMDLINE
if [[ "$2" =~ \.(json|JSON)$ ]]; then
fatal "No file name allowed after \"--json\" (use \"--jsonfile-pretty\" instead)" $ERR_CMDLINE
fi
do_pretty_json=true
;;
--jsonfile-pretty|--jsonfile-pretty=*|-oJ|-oJ=*)
Expand All @@ -19479,6 +19485,9 @@ parse_cmd_line() {
;;
--csv)
"$do_csv" && fatal "two --csv* arguments" $ERR_CMDLINE
if [[ "$2" =~ \.(csv|CSV)$ ]]; then
fatal "No file name allowed after \"--csv\" (use \"--csvfile\" instead)" $ERR_CMDLINE
fi
do_csv=true
;; # DEFINITION of CSVFILE is not arg specified: automagically in parse_hn_port()
# following does the same but additionally we can specify a log location
Expand All @@ -19490,6 +19499,9 @@ parse_cmd_line() {
;;
--html)
"$do_html" && fatal "two --html* arguments" $ERR_CMDLINE
if [[ "$2" =~ \.(htm|html|HTM|HTML)$ ]]; then
fatal "No file name allowed after \"--html\" (use \"--htmlfile\" instead)" $ERR_CMDLINE
fi
do_html=true
;; # DEFINITION of HTMLFILE is not arg specified: automagically in parse_hn_port()
# following does the same but additionally we can specify a file location
Expand Down

0 comments on commit 10fc141

Please sign in to comment.