Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
f331d7cd
Commit
f331d7cd
authored
Jul 09, 2014
by
Guillaume Melquiond
Browse files
Override the default --help message for why3.
Also be more consistent when using stdout/stderr.
parent
8ac305a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tools/main.ml
View file @
f331d7cd
...
...
@@ -35,6 +35,7 @@ let opt_list_formats = ref false
let
opt_list_metas
=
ref
false
let
opt_version
=
ref
false
let
opt_help
=
ref
false
let
option_list
=
Arg
.
align
[
"-C"
,
Arg
.
String
(
fun
s
->
opt_config
:=
Some
s
)
,
...
...
@@ -65,7 +66,9 @@ let option_list = Arg.align [
"--print-datadir"
,
Arg
.
Set
opt_print_datadir
,
" Print location of non-binary data (theories, modules, etc)"
;
"--version"
,
Arg
.
Set
opt_version
,
" Print version information"
]
" Print version information"
;
"--help"
,
Arg
.
Set
opt_help
,
" Display this list of options"
;
"-help"
,
Arg
.
Set
opt_help
,
" Display this list of options"
]
let
command_path
=
match
Config
.
localdir
with
...
...
@@ -95,7 +98,7 @@ let command sscmd =
let
scmd
=
try
List
.
assoc
sscmd
commands
with
Not_found
->
printf
"'%s' is not a why3 command.@
\n
@
\n
Available commands:@."
cmd
;
e
printf
"'%s' is not a why3 command.@
\n
@
\n
Available commands:@."
cmd
;
List
.
iter
(
fun
(
v
,_
)
->
eprintf
" %s@."
v
)
commands
;
exit
1
in
let
cmd
=
Filename
.
concat
command_path
scmd
in
...
...
@@ -116,6 +119,11 @@ let () = try
printf
"%s@."
version_msg
;
exit
0
end
;
if
!
opt_help
then
begin
printf
"%s@
\n
Available commands:@."
(
Arg
.
usage_string
option_list
usage_msg
);
List
.
iter
(
fun
(
v
,_
)
->
printf
" %s@."
v
)
(
available_commands
()
);
exit
0
end
;
if
!
opt_print_libdir
then
begin
printf
"%s@."
Config
.
libdir
;
exit
0
...
...
@@ -191,8 +199,8 @@ let () = try
opt_list
:=
Debug
.
Args
.
option_list
()
||
!
opt_list
;
if
!
opt_list
then
exit
0
;
e
printf
"%s@
\n
@
\n
Available commands:@."
usage_msg
;
List
.
iter
(
fun
(
v
,_
)
->
e
printf
" %s@."
v
)
(
available_commands
()
)
printf
"%s@
\n
@
\n
Available commands:@."
usage_msg
;
List
.
iter
(
fun
(
v
,_
)
->
printf
" %s@."
v
)
(
available_commands
()
)
with
e
when
not
(
Debug
.
test_flag
Debug
.
stack_trace
)
->
eprintf
"%a@."
Exn_printer
.
exn_printer
e
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment