feat(ocaml): Add OCaml module (#1218)

* Add OCaml module

* Update README.md accordingly

* Fix typo

* Add Reason support

Obtain OCaml version using `-vnum` flag.
Extend conditions to match projects using jbuild, esy
or merlin.

* Update README.md

Co-authored-by: Dario Vladovic <d.vladimyr@gmail.com>
This commit is contained in:
Hirochika Matsumoto
2020-05-22 01:43:13 +09:00
committed by GitHub
parent 1b2ea77b1c
commit 9e8f35d746
8 changed files with 250 additions and 0 deletions
+30
View File
@@ -116,6 +116,7 @@ prompt_order = [
"java",
"julia",
"nodejs",
"ocaml",
"php",
"python",
"ruby",
@@ -1098,6 +1099,35 @@ package, and shows its current version. The module currently supports `npm`, `ca
symbol = "🎁 "
```
## OCaml
The `ocaml` module shows the currently installed version of OCaml.
The module will be shown if any of the following conditions are met:
- The current directory contains a file with `.opam` extension or `_opam` directory
- The current directory contains a `esy.lock` directory
- The current directory contains a `dune` or `dune-project` file
- The current directory contains a `jbuild` or `jbuild-ignore` file
- The current directory contains a `.merlin` file
- The current directory contains a file with `.ml`, `.mli`, `.re` or `.rei` extension
### Options
| Variable | Default | Description |
| ---------- | --------------- | ------------------------------------------------------- |
| `symbol` | `"🐫 "` | The symbol used before displaying the version of OCaml. |
| `style` | `"bold yellow"` | The style for the module. |
| `disabled` | `false` | Disables the `ocaml` module. |
### Example
```toml
# ~/.config/starship.toml
[ocaml]
symbol = "🐪 "
```
## PHP
The `php` module shows the currently installed version of PHP.