Skip to content

Commit d56f9a4

Browse files
jasonevasilisp
authored andcommitted
Gracefully respond to invalid command line options. (#146)
Handle the Arg.Bad exception and print command line usage to stderr. Normalize the Arg.Help handler to omit an extra newline when printing command line usage.
1 parent 0c70d54 commit d56f9a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/baselib/ocsigen_commandline.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@ let cmdline : unit =
3939
]
4040
(fun _ -> ())
4141
"usage: ocsigen [-c configfile]"
42-
with Arg.Help s -> print_endline s; exit 0
42+
with
43+
| Arg.Help s -> print_string s; exit 0
44+
| Arg.Bad s -> prerr_string s; exit 1

0 commit comments

Comments
 (0)