github-tui/lib/cli.ml

27 lines
742 B
OCaml
Raw Normal View History

2024-01-07 17:59:21 +03:00
open Cmdliner
2024-01-07 15:57:06 +03:00
2024-01-07 17:59:21 +03:00
let repo_arg =
2024-01-07 21:08:58 +03:00
let doc = "The GitHub repository to view in TUI." in
2024-01-07 17:59:21 +03:00
Arg.(value & pos 0 string "NOT_SPECIFIED" & info [] ~docv:"OWNER/REPO" ~doc)
2024-01-07 15:57:06 +03:00
let path_arg =
let doc = "Path to a local directory of a GitHub repository" in
2024-03-23 13:26:12 +03:00
Arg.(
value
2024-06-23 19:29:16 +03:00
& opt (some string) None
2024-03-23 13:26:12 +03:00
& info [ "d"; "directory" ] ~docv:"DIRECTORY_PATH" ~doc)
2024-06-23 19:29:16 +03:00
let run repo local_path = Tui.start ~repo ~local_path
let gh_tui_term = Term.(const run $ repo_arg $ path_arg)
2024-01-07 17:59:21 +03:00
let cmd =
let doc = "TUI of a GitHub repository" in
2024-03-23 13:26:12 +03:00
let man =
[
`S Manpage.s_bugs;
`P "Submit bug reports at: https://github.com/chshersh/github-tui/issues";
]
2024-01-07 17:59:21 +03:00
in
let info = Cmd.info "gh-tui" ~version:"0.1.0" ~doc ~man in
Cmd.v info gh_tui_term