Skip to content

Commit 3fa8dce

Browse files
committed
Move GitHub client around
1 parent 71fa359 commit 3fa8dce

File tree

8 files changed

+35
-21
lines changed

8 files changed

+35
-21
lines changed

β€Žbin/main.mlβ€Ž

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1 @@
1-
(*
2-
let () = print_endline @@ Github_tui.Gh.query
3-
{|
4-
query {
5-
repository(owner: "chshersh", name: "zbg") {
6-
issues(last: 2, states: [OPEN], orderBy: {field: CREATED_AT, direction: DESC}) {
7-
nodes {
8-
number
9-
title
10-
author {
11-
login
12-
}
13-
}
14-
}
15-
}
16-
}
17-
|}
18-
*)
19-
201
let () = Github_tui.Main.main ()

β€Žlib/duneβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
(name github_tui)
33
(libraries
44
cmdliner
5-
ezcurl
65
;; Internal dependencies
76
tui))
File renamed without changes.

β€Žlib/gh/client.mliβ€Ž

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
(** A low level function to perform a query. Reads $GITHUB_TOKEN from the
2+
environment.
3+
4+
Usage example:
5+
6+
{[
7+
let () =
8+
print_endline
9+
@@ Github_tui.Gh.query
10+
{|
11+
query {
12+
repository(owner: "chshersh", name: "github-tui") {
13+
issues(last: 2, states: [OPEN], orderBy: {field: CREATED_AT, direction: ASC}) {
14+
nodes {
15+
number
16+
title
17+
author {
18+
login
19+
}
20+
}
21+
}
22+
}
23+
}
24+
|}
25+
]} *)
26+
val query : string -> string

β€Žlib/gh/duneβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(library
2+
(name gh)
3+
(libraries ezcurl))

β€Žlib/gh/gh.mlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Client = Client

β€Žlib/gh/gh.mliβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(** This module contains functions to query GitHub API *)
2+
3+
module Client = Client

β€Žlib/tui/tui.mlβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ let clone_repo ~repo ~local_path =
55
let owner, repo =
66
match String.split_on_char '/' repo with
77
| [ owner; repo ] -> (owner, repo)
8-
| _ -> ("chshersh", "zbg")
8+
| _ -> ("chshersh", "github-tui")
9+
(* TODO: lol *)
910
in
1011
let temp_dir =
1112
Filename.temp_dir "github-tui-" (Printf.sprintf "%s-%s" owner repo)

0 commit comments

Comments
Β (0)