Skip to content

Commit

Permalink
Use default Cmdliner.Term rather than usage function
Browse files Browse the repository at this point in the history
  • Loading branch information
n-osborne committed Apr 9, 2024
1 parent 0023018 commit 3707ec4
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions bin/cli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@ let () =

open Cmdliner

let usage () =
Format.(fprintf err_formatter)
"@[ortac: required plugin is missing, please install at least one@ \
(qcheck-stm,@ monolith@ or@ wrapper).@]@.";
exit Cmd.Exit.cli_error

let () =
match
let doc = "Run ORTAC." and version = "ortac version %%VERSION%%" in
let info = Cmd.info "ortac" ~doc ~version
and default = Term.(ret (const (`Help (`Pager, None))))
and cmds =
Registration.fold (fun acc cmd -> cmd :: acc) [] Registration.plugins
with
| [] -> usage ()
| cmds ->
let doc = "Run ORTAC." in
let version = "ortac version %%VERSION%%" in
let info = Cmd.info "ortac" ~doc ~version in
let group = Cmd.group info cmds in
Stdlib.exit (Cmd.eval group)
in
let group = Cmd.group info ~default cmds in
Stdlib.exit (Cmd.eval group)

0 comments on commit 3707ec4

Please sign in to comment.