2021-12-10 11:06:52 +00:00
|
|
|
let query_manifest file =
|
2021-12-07 21:51:25 +00:00
|
|
|
Owee_buf.map_binary file
|
2021-12-10 11:06:52 +00:00
|
|
|
|> Solo5_elftool.query_manifest
|
2021-12-09 15:17:11 +00:00
|
|
|
|> Result.iter (fun mft ->
|
2021-12-10 10:19:06 +00:00
|
|
|
Fmt.pr "%a\n" Solo5_elftool.pp_mft mft)
|
2021-12-07 21:51:25 +00:00
|
|
|
|
2021-12-16 11:12:43 +00:00
|
|
|
let query_abi file =
|
|
|
|
Owee_buf.map_binary file
|
|
|
|
|> Solo5_elftool.query_abi
|
|
|
|
|> Result.iter (Fmt.pr "%a\n" Solo5_elftool.pp_abi)
|
|
|
|
|
2021-12-07 21:51:25 +00:00
|
|
|
let file =
|
|
|
|
let doc = "Solo5 executable" in
|
|
|
|
Cmdliner.Arg.(required & pos 0 (some file) None &
|
|
|
|
info ~doc ~docv:"EXECUTABLE" [])
|
|
|
|
|
2021-12-10 11:06:52 +00:00
|
|
|
let query_manifest_cmd =
|
|
|
|
let doc = "query solo5 manifest" in
|
2021-12-07 21:51:25 +00:00
|
|
|
Cmdliner.Term.(
|
2021-12-10 11:06:52 +00:00
|
|
|
pure query_manifest $ file,
|
2021-12-07 21:51:25 +00:00
|
|
|
info ~doc "query-manifest")
|
|
|
|
|
2021-12-16 11:12:43 +00:00
|
|
|
let query_abi_cmd =
|
|
|
|
let doc = "query solo5 abi" in
|
|
|
|
Cmdliner.Term.(
|
|
|
|
pure query_abi $ file,
|
|
|
|
info ~doc "query-abi")
|
|
|
|
|
|
|
|
let default_cmd =
|
|
|
|
Cmdliner.Term.(
|
|
|
|
ret (pure (fun man_format -> `Help (man_format, None)) $ man_format),
|
|
|
|
info "osolo5-elftool")
|
|
|
|
|
2021-12-07 21:51:25 +00:00
|
|
|
let () =
|
2021-12-16 11:12:43 +00:00
|
|
|
ignore (Cmdliner.Term.eval_choice
|
|
|
|
default_cmd
|
|
|
|
[query_manifest_cmd; query_abi_cmd])
|