Skip to content

Commit

Permalink
Add mdx for lab cli.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgilchrist committed Jan 20, 2022
1 parent 494c60a commit c42d787
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 4 deletions.
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gitlab bindings for OCaml
==========
[![GitHub CI][github-shield]][github-ci] [![docs][docs-shield]][docs]
[![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)
[![OCaml-CI Build Status][ocaml-ci-shield]][ocaml-ci]

Native OCaml bindings to [Gitlab REST API v4].

Expand All @@ -12,8 +12,7 @@ Pre-requisites
----------

* Plain opam / ocaml for building.
* jd for diffing json (github.com/josephburnett/jd) in tests


Configuration
----------

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

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

Tests
------

Running mdx tests for lab cli:

``` shell
# Run integration tests against real gitlab instance
dune runtest --profile non-deterministic

# Promote any changes
dune runtest --profile non-deterministic --auto-promote
```

NOTE that ocaml-ci doesn't run these tests, any changes to the cli need to be validated manually.

[github-shield]: https://github.com/tmcgilchrist/ocaml-gitlab/actions/workflows/ci.yaml/badge.svg
[github-ci]: https://github.com/tmcgilchrist/ocaml-gitlab/actions/workflows/ci.yaml

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

[ocaml-ci]: https://ci.ocamllabs.io/github/tmcgilchrist/ocaml-gitlab
[ocaml-ci-shield]: https://img.shields.io/endpoint?url=https%3A%2F%2Fci.ocamllabs.io%2Fbadge%2Ftmcgilchrist%2Focaml-gitlab%2Fmaster&logo=ocaml
[Gitlab REST API v4]: https://docs.gitlab.com/ee/api/README.html

Resources
----------

[MDX Setup in RWO](https://github.com/realworldocaml/book/blob/master/Makefile#L14)
117 changes: 117 additions & 0 deletions cli/lab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
Lab CLI
==========

lab - makes git easier with GitLab

lab api - Low-level GitLab API request interface.

<!-- $MDX non-deterministic=command -->
```sh
$ dune install lab
...
[1]
```

<!-- $MDX non-deterministic=command -->
```sh
$ lab api "https://gitlab.com/api/v4/users?username=tmcgilchrist"
[
{
"id": 490393,
"username": "tmcgilchrist",
"name": "Tim McGilchrist",
"state": "active",
"avatar_url":
"https://secure.gravatar.com/avatar/67afd2b4c98c9befd18c19f0ee9d94dc?s=80&d=identicon",
"web_url": "https://gitlab.com/tmcgilchrist"
}
]
```

<!-- $MDX non-deterministic=command -->
```sh
$ lab user-name --owner-name tmcgilchrist
tmcgilchrist:490393
```

List user projects

<!-- $MDX non-deterministic=command -->
```sh
$ lab user-projects --owner 490393
tezos
ocaml-changes
ocaml-gitlab
freer
```

<!-- $MDX non-deterministic=command -->
```sh
$ lab --help
LAB(1) Lab Manual LAB(1)



NNAAMMEE
lab - make git easier with GitLab

SSYYNNOOPPSSIISS
llaabb _C_O_M_M_A_N_D ...

DDEESSCCRRIIPPTTIIOONN
Lab is a tool that wraps git in order to extend it with extra
functionality that makes it better when working with GitLab.

CCOOMMMMAANNDDSS
aappii -- LLooww--lleevveell GGiittLLaabb AAPPII rreeqquueesstt iinntteerrffaaccee


bbrraanncchh -- LLiisstt bbrraanncchheess ffoorr aa pprroojjeecctt


ccii--ssttaattuuss -- LLiisstt bbuuiilldd ssttaattuuss ooff aa ccoommmmiitt


mmeerrggee--rreeqquueessttss -- LLiisstt uusseerr''ss mmeerrggee rreeqquueessttss


pprroojjeecctt--ccrreeaattee -- CCrreeaatteess aa nneeww pprroojjeecctt oowwnneedd bbyy tthhee aauutthheennttiiccaatteedd uusseerr..


sseett--ccii--ssttaattuuss -- SSeett oorr uuppddaattee tthhee bbuuiilldd ssttaattuuss ooff aa ccoommmmiitt


ssttaattuuss--cchheecckkss -- LLiisstt eexxtteerrnnaall ssttaattuuss cchheecckkss


uusseerr--eevveennttss -- LLiisstt aallll uusseerr eevveennttss


uusseerr--lliisstt -- DDiissppllaayy uusseerr nnaammee aanndd iidd


uusseerr--nnaammee -- DDiissppllaayy uusseerrss bbyy nnaammee aanndd iidd


uusseerr--pprroojjeeccttss -- LLiisstt ppuubblliicc pprroojjeeccttss oowwnneedd bbyy tthhee uusseerr


OOPPTTIIOONNSS
----hheellpp[=_F_M_T] (default=auto)
Show this help in format _F_M_T. The value _F_M_T must be one of `auto',
`pager', `groff' or `plain'. With `auto', the format is `pager` or
`plain' whenever the TTEERRMM env var is `dumb' or undefined.
----vveerrssiioonn
Show version information.
BBUUGGSS
<https://github.com/tmcgilchrist/ocaml-gitlab/issues>
AAUUTTHHOORRSS
<https://github.com/tmcgilchrist/ocaml-gitlab>
Lab 0.1 LAB(1)
```
2 changes: 2 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(env
(non-deterministic (env-vars (MDX_RUN_NON_DETERMINISTIC true))))
3 changes: 2 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ This library installs the JavaScript version, which uses [js_of_ocaml](http://oc
(cmdliner (>= 0.9.8))
(gitlab-unix (= :version))
(cohttp-lwt-unix (>= 4.0))
(otoml (>= 0.9.0)))
(otoml (>= 0.9.0))
(mdx :with-test))
(synopsis "GitLab cli")
(description "Experimental GitLab cli in the style of GitHub's gh and hub commands."))

1 change: 1 addition & 0 deletions lab.opam
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ depends: [
"gitlab-unix" {= version}
"cohttp-lwt-unix" {>= "4.0"}
"otoml" {>= "0.9.0"}
"mdx" {with-test}
"odoc" {with-doc}
]
build: [
Expand Down

0 comments on commit c42d787

Please sign in to comment.