From 06f9cf2b45928daa7551ab9134969564824a501d Mon Sep 17 00:00:00 2001 From: Dmitrii Kovanikov Date: Sun, 7 Jan 2024 12:57:06 +0000 Subject: [PATCH] WIP: Add CLI --- bin/main.ml | 2 +- dune-project | 10 ++++++---- github_tui.opam | 10 ++++++---- lib/cli.ml | 10 ++++++++++ lib/dune | 6 +++++- lib/main.ml | 1 + 6 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 lib/cli.ml create mode 100644 lib/main.ml diff --git a/bin/main.ml b/bin/main.ml index d76c3b3..9021689 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -17,4 +17,4 @@ query { |} *) -let () = Github_tui.Tui.start () \ No newline at end of file +let () = Github_tui.Main.main () \ No newline at end of file diff --git a/dune-project b/dune-project index 87be024..30385c7 100644 --- a/dune-project +++ b/dune-project @@ -17,11 +17,13 @@ (synopsis "A short synopsis") (description "A longer description") (depends - ocaml + (ocaml (>= "5.1")) dune - ezcurl - minttea - terminal + (core (>= "v0.16.2")) + (core_unix (>= "v0.16.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 0d22be2..9484713 100644 --- a/github_tui.opam +++ b/github_tui.opam @@ -9,11 +9,13 @@ tags: ["tui" "cli" "git" "github"] homepage: "https://github.com/chshersh/github-tui" bug-reports: "https://github.com/chshersh/github-tui/issues" depends: [ - "ocaml" + "ocaml" {>= "5.1"} "dune" {>= "3.12"} - "ezcurl" - "minttea" - "terminal" + "core" {>= "v0.16.2"} + "core_unix" {>= "v0.16.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 new file mode 100644 index 0000000..77b18db --- /dev/null +++ b/lib/cli.ml @@ -0,0 +1,10 @@ +open Core + +let repo_param = + let open Command.Param in + anon ("owner/repo" %: string) + +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 diff --git a/lib/dune b/lib/dune index e775534..a8bae86 100644 --- a/lib/dune +++ b/lib/dune @@ -3,8 +3,12 @@ (library (name github_tui) (libraries + core + core_unix.command_unix ezcurl minttea - terminal + ) + (preprocess + (pps ppx_jane) ) ) diff --git a/lib/main.ml b/lib/main.ml new file mode 100644 index 0000000..f3985c4 --- /dev/null +++ b/lib/main.ml @@ -0,0 +1 @@ +let main () = Command_unix.run ~version:"0.1.0" ~build_info:"RWO" Cli.command \ No newline at end of file