Skip to content

Commit

Permalink
Update to cmdliner.1.1.0 and prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
reynir committed Mar 16, 2022
1 parent 082680d commit cce5571
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.3.1 (2022-03-16)

* Update to cmdliner 1.1.0

## v0.3.0 (2022-01-28)

* Exceptions from Owee are caught in `query_abi` and `query_manifest`
Expand Down
33 changes: 19 additions & 14 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,34 @@ let query_abi file =
|> Solo5_elftool.query_abi
|> Result.iter (Fmt.pr "%a\n" Solo5_elftool.pp_abi)

open Cmdliner

let file =
let doc = "Solo5 executable" in
Cmdliner.Arg.(required & pos 0 (some file) None &
info ~doc ~docv:"EXECUTABLE" [])
Arg.(required & pos 0 (some file) None &
info ~doc ~docv:"EXECUTABLE" [])

let query_manifest_cmd =
let doc = "query solo5 manifest" in
Cmdliner.Term.(
pure query_manifest $ file,
info ~doc "query-manifest")
Cmd.v
(Cmd.info ~doc "query-manifest")
Term.(const query_manifest $ file)

let query_abi_cmd =
let doc = "query solo5 abi" in
Cmdliner.Term.(
pure query_abi $ file,
info ~doc "query-abi")
Cmd.v
(Cmdliner.Cmd.info ~doc "query-abi")
Term.(const query_abi $ file)

let info = Cmd.info "osolo5-elftool"

let default_cmd =
Cmdliner.Term.(
ret (pure (fun man_format -> `Help (man_format, None)) $ man_format),
info "osolo5-elftool")
Term.(ret (const (fun man_format -> `Help (man_format, None)) $ Arg.man_format))

let () =
ignore (Cmdliner.Term.eval_choice
default_cmd
[query_manifest_cmd; query_abi_cmd])
let cmd =
Cmd.group
~default:default_cmd info
[query_manifest_cmd; query_abi_cmd]
in
Cmd.eval cmd |> exit
2 changes: 1 addition & 1 deletion solo5-elftool.opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ depends: [
"owee" {>= "0.4"}
"cstruct" {>= "6.0.0"}
"fmt" {>= "0.8.7"}
"cmdliner"
"cmdliner" {>= "1.1.0"}
]

conflicts: [
Expand Down

0 comments on commit cce5571

Please sign in to comment.