Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
(depends
(ocaml (>= "5.0.0~"))
hdr_histogram
(cmdliner (and (>= 1.1.0) (< 2.0)))
(cmdliner (>= 1.1.0))
(trace-fuchsia (>= 0.10))
(trace (>= 0.10))
(menhir :with-test)
Expand All @@ -32,4 +32,4 @@
(maintenance_intent "(latest)")
(depends
(ocaml (>= "5.0.0~"))
(cmdliner (and (>= 1.1.0) (< 2.0)))))
(cmdliner (>= 1.1.0))))
38 changes: 1 addition & 37 deletions lib/olly_common/cli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@ let help_secs =

let sdocs = Manpage.s_common_options

let help man_format cmds topic =
match topic with
| None -> `Help (`Pager, None) (* help about the program. *)
| Some topic -> (
let topics = "topics" :: cmds in
let conv, _ = Cmdliner.Arg.enum (List.rev_map (fun s -> (s, s)) topics) in
match conv topic with
| `Error e -> `Error (false, e)
| `Ok t when t = "topics" ->
List.iter print_endline topics;
`Ok ()
| `Ok t when List.mem t cmds -> `Help (man_format, Some t)
| `Ok _t ->
let page =
((topic, 7, "", "", ""), [ `S topic; `P "Say something" ])
in
`Ok (Manpage.print man_format Format.std_formatter page))

let runtime_events_dir =
let doc =
"Sets the directory where the .events files containing the runtime event \
Expand Down Expand Up @@ -126,28 +108,10 @@ let exec_args p =
Term.(term_result' ~usage:true (const combine $ attach_opt $ exec_and_args))

let main name commands =
let help_cmd =
let topic =
let doc = "The topic to get help on. $(b,topics) lists the topics." in
Arg.(value & pos 0 (some string) None & info [] ~docv:"TOPIC" ~doc)
in
let doc = "Display help about olly and olly commands." in
let man =
[
`S Manpage.s_description;
`P "Prints help about olly commands and other subjects…";
`Blocks help_secs;
]
in
let info = Cmd.info "help" ~doc ~man in
Cmd.v info
Term.(ret (const help $ Arg.man_format $ Term.choice_names $ topic))
in

let main_cmd =
let doc = "An observability tool for OCaml programs" in
let info = Cmd.info name ~doc ~sdocs in
Cmd.group info (commands @ [ help_cmd ])
Cmd.group info commands
in

exit (Cmd.eval main_cmd)
2 changes: 1 addition & 1 deletion runtime_events_tools.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ depends: [
"dune" {>= "3.18"}
"ocaml" {>= "5.0.0~"}
"hdr_histogram"
"cmdliner" {>= "1.1.0" & < "2.0"}
"cmdliner" {>= "1.1.0"}
"trace-fuchsia" {>= "0.10"}
"trace" {>= "0.10"}
"menhir" {with-test}
Expand Down
2 changes: 1 addition & 1 deletion runtime_events_tools_bare.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bug-reports: "https://github.com/tarides/runtime_events_tools/issues"
depends: [
"dune" {>= "3.18"}
"ocaml" {>= "5.0.0~"}
"cmdliner" {>= "1.1.0" & < "2.0"}
"cmdliner" {>= "1.1.0"}
"odoc" {with-doc}
]
build: [
Expand Down