Skip to content

Commit f5bb64a

Browse files
authored
Merge pull request #6 from tmattio/v2
2 parents e7d4436 + 938e859 commit f5bb64a

File tree

141 files changed

+2773
-25720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+2773
-25720
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Tell github that .re and .rei files are Reason
1+
# Tell github that .ml and .mli files are OCaml
22
*.ml linguist-language=OCaml
33
*.mli linguist-language=OCaml
44

.github/workflows/ci.yml

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,55 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
48

59
jobs:
6-
build:
7-
name: Build and test
8-
9-
runs-on: ${{ matrix.os }}
10+
build-and-test:
11+
name: CI
1012

1113
strategy:
1214
fail-fast: false
15+
1316
matrix:
1417
os:
1518
- macos-latest
1619
- ubuntu-latest
17-
ocaml-version:
18-
- 4.10.1
20+
- windows-latest
21+
22+
ocaml-compiler:
23+
- 4.12.x
24+
25+
runs-on: ${{ matrix.os }}
1926

2027
steps:
28+
2129
- name: Checkout code
2230
uses: actions/checkout@v2
2331

24-
- name: Retrieve opam cache
25-
uses: actions/cache@v2
26-
if: runner.os != 'Windows'
27-
id: cache-opam
28-
with:
29-
path: ~/.opam
30-
key: v1-${{ runner.os }}-opam-${{ matrix.ocaml-version }}-${{ hashFiles('inquire.opam.locked') }}
31-
restore-keys: |
32-
v1-${{ runner.os }}-opam-${{ matrix.ocaml-version }}-
33-
34-
- name: Use OCaml ${{ matrix.ocaml-version }}
35-
uses: avsm/setup-ocaml@v1
32+
- name: Use OCaml ${{ matrix.ocaml-compiler }}
33+
uses: avsm/setup-ocaml@v2
3634
with:
37-
ocaml-version: ${{ matrix.ocaml-version }}
35+
ocaml-compiler: ${{ matrix.ocaml-compiler }}
36+
dune-cache: ${{ matrix.os != 'macos-latest' }}
37+
opam-depext-flags: --with-test
3838

39-
- name: Pin package
40-
run: opam pin add inquire.dev . --no-action
39+
- name: Install ocamlformat
40+
run: opam install ocamlformat.0.18.0
41+
if: ${{ matrix.os == 'ubuntu-latest' }}
4142

42-
- name: Query and install external dependencies
43-
run: opam depext inquire --yes --with-doc --with-test
43+
- name: Install opam packages
44+
run: opam install . --with-test
4445

45-
- name: Install dependencies
46-
if: steps.cache-opam.outputs.cache-hit != 'true'
47-
run: |
48-
opam install . --deps-only --with-doc --with-test --locked --unlock-base
49-
opam install ocamlformat --skip-updates
46+
- name: Install examples opam packages
47+
run: opam install cmdliner
5048

51-
- name: Upgrade dependencies
52-
run: opam upgrade --fixup
53-
if: steps.cache-opam.outputs.cache-hit == 'true'
49+
- name: Check formatting
50+
run: make fmt
51+
if: ${{ matrix.os == 'ubuntu-latest' && always() }}
5452

55-
- name: Build
53+
- name: Run build
5654
run: make build
5755

58-
- name: Check formatting
59-
run: make format
60-

.gitignore

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
# ocamlbuild working directory
1+
# Dune working directory
22
_build/
3-
4-
# ocamlbuild targets
5-
*.byte
6-
*.native
7-
8-
# Merlin configuring file for Vim and Emacs
9-
.merlin
10-
11-
# Dune generated files
123
*.install
134

145
# Local OPAM switch

.ocamlformat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version = 0.18.0
12
profile = sparse
23
break-cases = nested
34
break-fun-decl = smart
@@ -15,4 +16,4 @@ ocp-indent-compat = true
1516
wrap-comments = true
1617
parse-docstrings = true
1718
let-binding-spacing = compact
18-
type-decl = sparse
19+
type-decl = sparse

CHANGES.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# 0.3.0 - 2021-05-17
2+
3+
## Added
4+
5+
- Improved all prompts prompt to handle escape sequences (e.g. "Ctrl-L" will clear the screen while reading from answer).
6+
- Improved `select` to allow selection using indexes.
7+
- Improved prompts to clear defaults and other tooltip on a valid answer and print the answer after the prompt.
8+
9+
## Changed
10+
11+
- Stripped out `lambda-term` dependency
12+
- Removed `lwt` integration
13+
114
# 0.2.1 - 2020-10-04
215

316
## Changed

CONTRIBUTING.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Contributing
2+
3+
## Setup your development environment
4+
5+
You need Opam, you can install it by following [Opam's documentation](https://opam.ocaml.org/doc/Install.html).
6+
7+
With Opam installed, you can install the dependencies in a new local switch with:
8+
9+
```bash
10+
make switch
11+
```
12+
13+
Or globally, with:
14+
15+
```bash
16+
make deps
17+
```
18+
19+
Then, build the project with:
20+
21+
```bash
22+
make build
23+
```
24+
25+
### Running Binary
26+
27+
After building the project, you can run the main binary that is produced.
28+
29+
30+
```bash
31+
make start
32+
```
33+
34+
### Running Tests
35+
36+
You can run the test compiled executable:
37+
38+
39+
```bash
40+
make test
41+
```
42+
43+
### Building documentation
44+
45+
Documentation for the libraries in the project can be generated with:
46+
47+
48+
```bash
49+
make doc
50+
open-cli $(make doc-path)
51+
```
52+
53+
This assumes you have a command like [open-cli](https://github.com/sindresorhus/open-cli) installed on your system.
54+
55+
> NOTE: On macOS, you can use the system command `open`, for instance `open $(make doc-path)`
56+
57+
### Repository Structure
58+
59+
The following snippet describes Inquire's repository structure.
60+
61+
```text
62+
.
63+
├── bin/
64+
| Source for inquire's binary. This links to the library defined in `lib/`.
65+
66+
├── lib/
67+
| Source for Inquire's library. Contains Inquire's core functionnalities.
68+
69+
├── test/
70+
| Unit tests and integration tests for Inquire.
71+
72+
├── dune-project
73+
| Dune file used to mark the root of the project and define project-wide parameters.
74+
| For the documentation of the syntax, see https://dune.readthedocs.io/en/stable/dune-files.html#dune-project
75+
76+
├── LICENSE
77+
78+
├── Makefile
79+
| Make file containing common development command.
80+
81+
├── README.md
82+
83+
└── inquire.opam
84+
Opam package definition.
85+
To know more about creating and publishing opam packages, see https://opam.ocaml.org/doc/Packaging.html.
86+
```

LICENSE

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
Copyright 2019 Thibaut Mattio
1+
MIT License
22

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3+
Copyright (c) 2020 Thibaut Mattio
44

5-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
611

7-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,55 @@
11
.PHONY: all
22
all:
3-
opam exec -- dune build @install
3+
opam exec -- dune build --root . @install
44

5-
.PHONY: dev
6-
dev:
7-
opam install dune-release merlin ocamlformat utop
5+
.PHONY: deps
6+
deps: ## Install development dependencies
7+
opam install -y dune-release merlin ocamlformat utop ocaml-lsp-server
88
opam install --deps-only --with-test --with-doc -y .
99

10+
.PHONY: create_switch
11+
create_switch:
12+
opam switch create . --no-install
13+
14+
.PHONY: switch
15+
switch: create_switch deps ## Create an opam switch and install development dependencies
16+
17+
.PHONY: lock
18+
lock: ## Generate a lock file
19+
opam lock -y .
20+
1021
.PHONY: build
11-
build:
12-
opam exec -- dune build
22+
build: ## Build the project, including non installable libraries and executables
23+
opam exec -- dune build --root .
1324

1425
.PHONY: install
15-
install:
16-
opam exec -- dune install
26+
install: all ## Install the packages on the system
27+
opam exec -- dune install --root .
28+
29+
.PHONY: start
30+
start: all ## Run the produced executable
31+
opam exec -- dune exec --root . bin/main.exe $(ARGS)
32+
33+
.PHONY: test
34+
test: ## Run the unit tests
35+
opam exec -- dune build --root . @test/runtest -f
1736

1837
.PHONY: clean
19-
clean:
20-
opam exec -- dune clean
38+
clean: ## Clean build artifacts and other generated files
39+
opam exec -- dune clean --root .
2140

2241
.PHONY: doc
23-
doc:
24-
opam exec -- dune build @doc
25-
26-
.PHONY: doc-path
27-
doc-path:
28-
@echo "_build/default/_doc/_html/index.html"
42+
doc: ## Generate odoc documentation
43+
opam exec -- dune build --root . @doc
2944

30-
.PHONY: format
31-
format:
32-
opam exec -- dune build @fmt --auto-promote
45+
.PHONY: fmt
46+
fmt: ## Format the codebase with ocamlformat
47+
opam exec -- dune build --root . --auto-promote @fmt
3348

3449
.PHONY: watch
35-
watch:
36-
opam exec -- dune build --watch
50+
watch: ## Watch for the filesystem and rebuild on every change
51+
opam exec -- dune build --root . --watch
3752

3853
.PHONY: utop
39-
utop:
40-
opam exec -- dune utop lib -- -implicit-bindings
41-
42-
.PHONY: release
43-
release:
44-
opam exec -- sh script/release.sh
54+
utop: ## Run a REPL and link with the project's libraries
55+
opam exec -- dune utop --root . lib -- -implicit-bindings

0 commit comments

Comments
 (0)