diff --git a/dune-project b/dune-project index 30385c7..1b4d207 100644 --- a/dune-project +++ b/dune-project @@ -19,11 +19,9 @@ (depends (ocaml (>= "5.1")) dune - (core (>= "v0.16.2")) - (core_unix (>= "v0.16.0")) + (cmdliner (>= "1.2.0")) (ezcurl (>= "0.2.4")) (minttea (>= "0.0.2")) - (ppx_jane (>= "v0.16.0")) ) (tags (tui cli git github))) diff --git a/github_tui.opam b/github_tui.opam index 9484713..260948b 100644 --- a/github_tui.opam +++ b/github_tui.opam @@ -11,11 +11,9 @@ bug-reports: "https://github.com/chshersh/github-tui/issues" depends: [ "ocaml" {>= "5.1"} "dune" {>= "3.12"} - "core" {>= "v0.16.2"} - "core_unix" {>= "v0.16.0"} + "cmdliner" {>= "1.2.0"} "ezcurl" {>= "0.2.4"} "minttea" {>= "0.0.2"} - "ppx_jane" {>= "v0.16.0"} "odoc" {with-doc} ] build: [ diff --git a/lib/cli.ml b/lib/cli.ml index 77b18db..0889ecb 100644 --- a/lib/cli.ml +++ b/lib/cli.ml @@ -1,10 +1,16 @@ -open Core +open Cmdliner -let repo_param = - let open Command.Param in - anon ("owner/repo" %: string) +let repo_arg = + let doc = "The GitHub repository to launch." in + Arg.(value & pos 0 string "NOT_SPECIFIED" & info [] ~docv:"OWNER/REPO" ~doc) -let command = - Command.basic - ~summary:"Display GitHub TUI for the selected repository" - (Command.Param.map repo_param ~f:(fun _repo () -> Tui.start ())) \ No newline at end of file +let gh_tui_t = Term.(const Tui.start $ repo_arg) + +let cmd = + let doc = "TUI of a GitHub repository" in + let man = [ + `S Manpage.s_bugs; + `P "Submit bug reports at: https://github.com/chshersh/github-tui/issues" ] + in + let info = Cmd.info "gh-tui" ~version:"0.1.0" ~doc ~man in + Cmd.v info gh_tui_t diff --git a/lib/dune b/lib/dune index a8bae86..a2a3ffd 100644 --- a/lib/dune +++ b/lib/dune @@ -3,12 +3,8 @@ (library (name github_tui) (libraries - core - core_unix.command_unix + cmdliner ezcurl minttea ) - (preprocess - (pps ppx_jane) - ) ) diff --git a/lib/main.ml b/lib/main.ml index f3985c4..67b050d 100644 --- a/lib/main.ml +++ b/lib/main.ml @@ -1 +1 @@ -let main () = Command_unix.run ~version:"0.1.0" ~build_info:"RWO" Cli.command \ No newline at end of file +let main () = exit (Cmdliner.Cmd.eval Cli.cmd) \ No newline at end of file diff --git a/lib/tui.ml b/lib/tui.ml index a8edc0d..883cd6d 100644 --- a/lib/tui.ml +++ b/lib/tui.ml @@ -1,2 +1,3 @@ let app = Minttea.app ~init:Init.init ~update:Update.update ~view:View.view () -let start () = Minttea.start app ~initial_model:Model.initial_model \ No newline at end of file + +let start _repo_name = Minttea.start app ~initial_model:Model.initial_model \ No newline at end of file