Skip to content

Commit c42d787

Browse files
committed
Add mdx for lab cli.
1 parent 494c60a commit c42d787

File tree

5 files changed

+146
-4
lines changed

5 files changed

+146
-4
lines changed

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gitlab bindings for OCaml
22
==========
33
[![GitHub CI][github-shield]][github-ci] [![docs][docs-shield]][docs]
4-
[![OCaml-CI Build Status](https://img.shields.io/endpoint?url=https%3A%2F%2Fci.ocamllabs.io%2Fbadge%2Ftmcgilchrist%2Focaml-gitlab%2Fmaster&logo=ocaml)](https://ci.ocamllabs.io/github/tmcgilchrist/ocaml-gitlab)
4+
[![OCaml-CI Build Status][ocaml-ci-shield]][ocaml-ci]
55

66
Native OCaml bindings to [Gitlab REST API v4].
77

@@ -12,8 +12,7 @@ Pre-requisites
1212
----------
1313

1414
* Plain opam / ocaml for building.
15-
* jd for diffing json (github.com/josephburnett/jd) in tests
16-
15+
1716
Configuration
1817
----------
1918

@@ -52,10 +51,32 @@ If you opam install lab then the executable is available as `lab`.
5251

5352
Run `lab -h` for more information about cli options.
5453

54+
Tests
55+
------
56+
57+
Running mdx tests for lab cli:
58+
59+
``` shell
60+
# Run integration tests against real gitlab instance
61+
dune runtest --profile non-deterministic
62+
63+
# Promote any changes
64+
dune runtest --profile non-deterministic --auto-promote
65+
```
66+
67+
NOTE that ocaml-ci doesn't run these tests, any changes to the cli need to be validated manually.
68+
5569
[github-shield]: https://github.com/tmcgilchrist/ocaml-gitlab/actions/workflows/ci.yaml/badge.svg
5670
[github-ci]: https://github.com/tmcgilchrist/ocaml-gitlab/actions/workflows/ci.yaml
5771

5872
[docs-shield]:https://img.shields.io/badge/doc-online-blue.svg
5973
[docs]: https://tmcgilchrist.github.io/ocaml-gitlab/gitlab/index.html
6074

75+
[ocaml-ci]: https://ci.ocamllabs.io/github/tmcgilchrist/ocaml-gitlab
76+
[ocaml-ci-shield]: https://img.shields.io/endpoint?url=https%3A%2F%2Fci.ocamllabs.io%2Fbadge%2Ftmcgilchrist%2Focaml-gitlab%2Fmaster&logo=ocaml
6177
[Gitlab REST API v4]: https://docs.gitlab.com/ee/api/README.html
78+
79+
Resources
80+
----------
81+
82+
[MDX Setup in RWO](https://github.com/realworldocaml/book/blob/master/Makefile#L14)

cli/lab.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
Lab CLI
2+
==========
3+
4+
lab - makes git easier with GitLab
5+
6+
lab api - Low-level GitLab API request interface.
7+
8+
<!-- $MDX non-deterministic=command -->
9+
```sh
10+
$ dune install lab
11+
...
12+
[1]
13+
```
14+
15+
<!-- $MDX non-deterministic=command -->
16+
```sh
17+
$ lab api "https://gitlab.com/api/v4/users?username=tmcgilchrist"
18+
[
19+
{
20+
"id": 490393,
21+
"username": "tmcgilchrist",
22+
"name": "Tim McGilchrist",
23+
"state": "active",
24+
"avatar_url":
25+
"https://secure.gravatar.com/avatar/67afd2b4c98c9befd18c19f0ee9d94dc?s=80&d=identicon",
26+
"web_url": "https://gitlab.com/tmcgilchrist"
27+
}
28+
]
29+
```
30+
31+
<!-- $MDX non-deterministic=command -->
32+
```sh
33+
$ lab user-name --owner-name tmcgilchrist
34+
tmcgilchrist:490393
35+
```
36+
37+
List user projects
38+
39+
<!-- $MDX non-deterministic=command -->
40+
```sh
41+
$ lab user-projects --owner 490393
42+
tezos
43+
ocaml-changes
44+
ocaml-gitlab
45+
freer
46+
```
47+
48+
<!-- $MDX non-deterministic=command -->
49+
```sh
50+
$ lab --help
51+
LAB(1) Lab Manual LAB(1)
52+
53+
54+
55+
NNAAMMEE
56+
lab - make git easier with GitLab
57+
58+
SSYYNNOOPPSSIISS
59+
llaabb _C_O_M_M_A_N_D ...
60+
61+
DDEESSCCRRIIPPTTIIOONN
62+
Lab is a tool that wraps git in order to extend it with extra
63+
functionality that makes it better when working with GitLab.
64+
65+
CCOOMMMMAANNDDSS
66+
aappii -- LLooww--lleevveell GGiittLLaabb AAPPII rreeqquueesstt iinntteerrffaaccee
67+
68+
69+
bbrraanncchh -- LLiisstt bbrraanncchheess ffoorr aa pprroojjeecctt
70+
71+
72+
ccii--ssttaattuuss -- LLiisstt bbuuiilldd ssttaattuuss ooff aa ccoommmmiitt
73+
74+
75+
mmeerrggee--rreeqquueessttss -- LLiisstt uusseerr''ss mmeerrggee rreeqquueessttss
76+
77+
78+
pprroojjeecctt--ccrreeaattee -- CCrreeaatteess aa nneeww pprroojjeecctt oowwnneedd bbyy tthhee aauutthheennttiiccaatteedd uusseerr..
79+
80+
81+
sseett--ccii--ssttaattuuss -- SSeett oorr uuppddaattee tthhee bbuuiilldd ssttaattuuss ooff aa ccoommmmiitt
82+
83+
84+
ssttaattuuss--cchheecckkss -- LLiisstt eexxtteerrnnaall ssttaattuuss cchheecckkss
85+
86+
87+
uusseerr--eevveennttss -- LLiisstt aallll uusseerr eevveennttss
88+
89+
90+
uusseerr--lliisstt -- DDiissppllaayy uusseerr nnaammee aanndd iidd
91+
92+
93+
uusseerr--nnaammee -- DDiissppllaayy uusseerrss bbyy nnaammee aanndd iidd
94+
95+
96+
uusseerr--pprroojjeeccttss -- LLiisstt ppuubblliicc pprroojjeeccttss oowwnneedd bbyy tthhee uusseerr
97+
98+
99+
OOPPTTIIOONNSS
100+
----hheellpp[=_F_M_T] (default=auto)
101+
Show this help in format _F_M_T. The value _F_M_T must be one of `auto',
102+
`pager', `groff' or `plain'. With `auto', the format is `pager` or
103+
`plain' whenever the TTEERRMM env var is `dumb' or undefined.
104+
105+
----vveerrssiioonn
106+
Show version information.
107+
108+
BBUUGGSS
109+
<https://github.com/tmcgilchrist/ocaml-gitlab/issues>
110+
111+
AAUUTTHHOORRSS
112+
<https://github.com/tmcgilchrist/ocaml-gitlab>
113+
114+
115+
116+
Lab 0.1 LAB(1)
117+
```

dune

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(env
2+
(non-deterministic (env-vars (MDX_RUN_NON_DETERMINISTIC true))))

dune-project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ This library installs the JavaScript version, which uses [js_of_ocaml](http://oc
6565
(cmdliner (>= 0.9.8))
6666
(gitlab-unix (= :version))
6767
(cohttp-lwt-unix (>= 4.0))
68-
(otoml (>= 0.9.0)))
68+
(otoml (>= 0.9.0))
69+
(mdx :with-test))
6970
(synopsis "GitLab cli")
7071
(description "Experimental GitLab cli in the style of GitHub's gh and hub commands."))
7172

lab.opam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ depends: [
1616
"gitlab-unix" {= version}
1717
"cohttp-lwt-unix" {>= "4.0"}
1818
"otoml" {>= "0.9.0"}
19+
"mdx" {with-test}
1920
"odoc" {with-doc}
2021
]
2122
build: [

0 commit comments

Comments
 (0)