Skip to content

Commit

Permalink
Switch to Cmdliner 1.1.0 (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilankri authored Mar 29, 2022
1 parent a536209 commit 4db11cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion opam-publish.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
dev-repo: "git+https://github.com/ocaml/opam-publish.git"
build: [ "dune" "build" "-p" name "-j" jobs ]
depends: [
"cmdliner" {>= "1.0.0"}
"cmdliner" {>= "1.1.0"}
"dune" {>= "1.0"}
"lwt_ssl"
"ocaml" {>= "4.03.0"}
Expand Down
11 changes: 6 additions & 5 deletions src/publishMain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -674,13 +674,13 @@ let main_term root =
files
in
let open Args in
Term.(pure run
Term.(const run
$ src_args $ force $ tag $ version $ dry_run $ output_patch $ no_browser
$ repo $ target_branch $ packages_dir $ title $ msg_file $ split)


let main_info =
Term.info "opam-publish"
Cmd.info "opam-publish"
~version:Version.version
~doc:"Helper for package publications on opam repositories"
~man:[
Expand Down Expand Up @@ -737,10 +737,11 @@ let () =
OpamCoreConfig.init ();
OpamStateConfig.init ~root_dir:opam_root ();
let publish_root = OpamFilename.Op.(opam_root / "plugins" / "opam-publish") in
let main_command = Cmd.v main_info (main_term publish_root) in
try
match Term.eval ~catch:false (main_term publish_root, main_info) with
| `Ok () | `Version | `Help -> OpamStd.Sys.exit_because `Success
| `Error _ -> OpamStd.Sys.exit_because `Bad_arguments
match Cmd.eval_value ~catch:false main_command with
| Ok (`Ok () | `Version | `Help) -> OpamStd.Sys.exit_because `Success
| Error _ -> OpamStd.Sys.exit_because `Bad_arguments
with
| OpamStd.Sys.Exit i -> exit i
| Failure e ->
Expand Down

0 comments on commit 4db11cd

Please sign in to comment.