mirror of
https://github.com/chshersh/github-tui.git
synced 2024-09-11 10:35:35 +03:00
Implement CLI using Cmdliner
This commit is contained in:
parent
06f9cf2b45
commit
0449be97f1
@ -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)))
|
||||
|
@ -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: [
|
||||
|
22
lib/cli.ml
22
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 ()))
|
||||
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
|
||||
|
6
lib/dune
6
lib/dune
@ -3,12 +3,8 @@
|
||||
(library
|
||||
(name github_tui)
|
||||
(libraries
|
||||
core
|
||||
core_unix.command_unix
|
||||
cmdliner
|
||||
ezcurl
|
||||
minttea
|
||||
)
|
||||
(preprocess
|
||||
(pps ppx_jane)
|
||||
)
|
||||
)
|
||||
|
@ -1 +1 @@
|
||||
let main () = Command_unix.run ~version:"0.1.0" ~build_info:"RWO" Cli.command
|
||||
let main () = exit (Cmdliner.Cmd.eval Cli.cmd)
|
@ -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
|
||||
|
||||
let start _repo_name = Minttea.start app ~initial_model:Model.initial_model
|
Loading…
Reference in New Issue
Block a user