Skip to content

Commit

Permalink
Rename repo and project
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbin committed Sep 7, 2024
1 parent 4b2744b commit 8a4117f
Show file tree
Hide file tree
Showing 72 changed files with 256 additions and 378 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"cmdlang",
"cmdliner",
"janestreet",
"odoc",
Expand Down
10 changes: 8 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.0.4 (unreleased)

### Changed

- Rename project `cmdlang`.

## 0.0.3 (2024-09-03)

### Changed
Expand All @@ -13,13 +19,13 @@

### Changed

- Make `commandlang-err` and standalone library called `err0` so it can be used more broadly. Split the handler part as a separated lib `err0-handler`.
- Make `cmdlang-err` and standalone library called `err0` so it can be used more broadly. Split the handler part as a separated lib `err0-handler`.

## 0.0.1 (2024-08-22)

### Added

- Added library `Err` establishing a standard for error handling in commandlang CLIs.
- Added library `Err` establishing a standard for error handling in cmdlang CLIs.

## 0.0.1_preview-0.1 (2024-08-19)

Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# commandlang
# cmdlang

[![CI Status](https://github.com/mbarbin/commandlang/workflows/ci/badge.svg)](https://github.com/mbarbin/commandlang/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/mbarbin/commandlang/badge.svg?branch=main)](https://coveralls.io/github/mbarbin/commandlang?branch=main)
[![Deploy Doc Status](https://github.com/mbarbin/commandlang/workflows/deploy-doc/badge.svg)](https://github.com/mbarbin/commandlang/actions/workflows/deploy-doc.yml)
[![CI Status](https://github.com/mbarbin/cmdlang/workflows/ci/badge.svg)](https://github.com/mbarbin/cmdlang/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/mbarbin/cmdlang/badge.svg?branch=main)](https://coveralls.io/github/mbarbin/cmdlang?branch=main)
[![Deploy Doc Status](https://github.com/mbarbin/cmdlang/workflows/deploy-doc/badge.svg)](https://github.com/mbarbin/cmdlang/actions/workflows/deploy-doc.yml)

Declarative Command-line Parsing for OCaml.

## Synopsys

Commandlang is a library for creating command-line parsers in OCaml. Implemented as an OCaml EDSL, its declarative specification language lives at the intersection of other well-established similar libraries.
Cmdlang is a library for creating command-line parsers in OCaml. Implemented as an OCaml EDSL, its declarative specification language lives at the intersection of other well-established similar libraries.

Commandlang doesn't include an execution engine. Instead, Commandlang parsers are automatically translated to `cmdliner`, `core.command`, or `climate` commands for execution.
Cmdlang doesn't include an execution engine. Instead, Cmdlang parsers are automatically translated to `cmdliner`, `core.command`, or `climate` commands for execution.

Our goal is to provide an approachable, flexible, and user-friendly interface while allowing users to choose the backend runtime that best suits their needs.

## Documentation

Commandlang's documentation is published [here](https://mbarbin.github.io/commandlang).
Cmdlang's documentation is published [here](https://mbarbin.github.io/cmdlang).

## Rationale

Expand All @@ -29,7 +29,7 @@ There is also a third library under development:

3. [climate](https://github.com/gridbugs/climate), aiming to support autocompletion scripts and other conventions.

The following table reflects our understanding and preferences (ranked 1-3, most preferred first) as of the early days of `commandlang` (your mileage may vary):
The following table reflects our understanding and preferences (ranked 1-3, most preferred first) as of the early days of `cmdlang` (your mileage may vary):

| Library | Runtime (eval) | Ergonomic (mli) | CLI conventions | Man pages | Auto-complete |
|----------------|:----------------------:|:-----------------:|:-----------------:|:----------:|:---------------:|
Expand All @@ -41,49 +41,49 @@ The following table reflects our understanding and preferences (ranked 1-3, most

**CLI syntax support**: Both `cmdliner` and `climate` support established conventions. We find that these conventions are harder to achieve with `core.command`, especially regarding its handling of long flag name arguments beginning with a single `-`.

The `commandlang` developers are enthusiastic to the prospect of compatible ways of working with these libraries.
The `cmdlang` developers are enthusiastic to the prospect of compatible ways of working with these libraries.

As developers of CLI tools written in OCaml, we aim to avoid a strong commitment to any single library if possible, especially concerning the runtime aspects. This is particularly relevant for new commands written today.

In this spirit, we created `commandlang`, a new library that offers a unique twist: it doesn't implement its own runtime. Instead, it translates its parsers into `cmdliner`, `core.command`, or `climate` parsers, making it compatible with all their execution engines.
In this spirit, we created `cmdlang`, a new library that offers a unique twist: it doesn't implement its own runtime. Instead, it translates its parsers into `cmdliner`, `core.command`, or `climate` parsers, making it compatible with all their execution engines.

Our current preferred target is depicted below, but other combinations are possible:

| Library | Runtime (eval) | Ergonomic (mli) | CLI conventions | Man pages | Auto-complete |
|---------------|:----------------:|:---------------------:|:-----------------:|:-----------:|:---------------:|
| commandlang | Battled-tested | 1 | 1 | Yes | Yes* |
| cmdlang | Battled-tested | 1 | 1 | Yes | Yes* |
| via | cmdliner | inspired by climate | cmdliner | cmdliner | Hybrid* |

`*` Auto-completion: we plan to say more about it in the doc in the near future.

Due to its architecture, `commandlang` can be a helpful tool for implementing effective migration paths to transition from one of the existing libraries to another.
Due to its architecture, `cmdlang` can be a helpful tool for implementing effective migration paths to transition from one of the existing libraries to another.

We initiated the library as part of another project where we are migrating some commands from `core.command` to `cmdliner`, with the desire to make it easy to experiment with `climate` in the future.

## Architecture

`commandlang` is composed of several parts:
`cmdlang` is composed of several parts:

1. **Core Specification Language**:
- A kernel command-line parsing specification language written as an OCaml EDSL.
- Covers the intersection of what is expressible in `cmdliner`, `core.command`, and `climate`.

2. **OCaml Library**:
- Exposes a single module, `Commandlang.Command`, with no dependencies, to build command-line parsers in total abstraction using ergonomic helpers.
- Exposes a single module, `Cmdlang.Command`, with no dependencies, to build command-line parsers in total abstraction using ergonomic helpers.
- Supports various styles for writing command-lines, including `( let+ )` and `ppx_let`'s `let%map` or `let%map_open`.
- Designed with ocaml-lsp in mind for user-friendly in-context completion.

3. **Translation Libraries**:
- Convert `commandlang` parsers at runtime into `cmdliner`, `core.command`, or `climate` parsers
- Convert `cmdlang` parsers at runtime into `cmdliner`, `core.command`, or `climate` parsers
- Packaged as separate helper libraries to keep dependencies isolated.

## Experimental Status

`commandlang` is currently under construction and considered experimental. We are actively seeking feedback to validate our design and engage with other declarative command-line enthusiasts.
`cmdlang` is currently under construction and considered experimental. We are actively seeking feedback to validate our design and engage with other declarative command-line enthusiasts.

## Acknowledgements

- We are grateful for the years of accumulated work and experience that have resulted in high-quality CLI libraries like `cmdliner` and `core.command`.
- `climate`'s early programming interface was a great source of inspiration. We are very thankful for their work on auto-completion and excited to see where the `climate` project goes next.
- We would like to thank the Dune developers for the user-facing error handling of Dune (`Stdune.User_message`), on which we based the error handling scheme used in commandlang (`Err`). By adopting a similar approach, we aim to provide a consistent and unified user experience for OCaml users across different tools and libraries.
- We would like to thank the Dune developers for the user-facing error handling of Dune (`Stdune.User_message`), on which we based the error handling scheme used in cmdlang (`Err`). By adopting a similar approach, we aim to provide a consistent and unified user experience for OCaml users across different tools and libraries.
- We are inspired by the [diataxis](https://diataxis.fr/) approach to technical documentation, which we use to structure our documentation.
18 changes: 9 additions & 9 deletions commandlang-tests.opam → cmdlang-tests.opam
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Tests for commandlang"
synopsis: "Tests for cmdlang"
maintainer: ["Mathieu Barbin"]
authors: ["Mathieu Barbin"]
license: "MIT"
homepage: "https://github.com/mbarbin/commandlang"
doc: "https://mbarbin.github.io/commandlang/"
bug-reports: "https://github.com/mbarbin/commandlang/issues"
homepage: "https://github.com/mbarbin/cmdlang"
doc: "https://mbarbin.github.io/cmdlang/"
bug-reports: "https://github.com/mbarbin/cmdlang/issues"
depends: [
"dune" {>= "3.16"}
"ocaml" {>= "5.2"}
Expand All @@ -15,10 +15,10 @@ depends: [
"bisect_ppx" {with-dev-setup & >= "2.8.3"}
"climate" {= "0.0.1~preview-0.1"}
"cmdliner" {= "1.3.0"}
"commandlang" {= version}
"commandlang-to-base" {= version}
"commandlang-to-climate" {= version}
"commandlang-to-cmdliner" {= version}
"cmdlang" {= version}
"cmdlang-to-base" {= version}
"cmdlang-to-climate" {= version}
"cmdlang-to-cmdliner" {= version}
"core" {>= "v0.17" & < "v0.18"}
"core_unix" {>= "v0.17" & < "v0.18"}
"err" {= version}
Expand Down Expand Up @@ -55,4 +55,4 @@ build: [
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/mbarbin/commandlang.git"
dev-repo: "git+https://github.com/mbarbin/cmdlang.git"
15 changes: 6 additions & 9 deletions commandlang-to-base.opam → cmdlang-to-base.opam
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Convert commandlang Parsers to core.command"
synopsis: "Convert cmdlang Parsers to core.command"
maintainer: ["Mathieu Barbin"]
authors: ["Mathieu Barbin"]
license: "MIT"
homepage: "https://github.com/mbarbin/commandlang"
doc: "https://mbarbin.github.io/commandlang/"
bug-reports: "https://github.com/mbarbin/commandlang/issues"
homepage: "https://github.com/mbarbin/cmdlang"
doc: "https://mbarbin.github.io/cmdlang/"
bug-reports: "https://github.com/mbarbin/cmdlang/issues"
depends: [
"dune" {>= "3.16"}
"ocaml" {>= "5.2"}
"ocamlformat" {with-dev-setup & = "0.26.2"}
"base" {>= "v0.17" & < "v0.18"}
"bisect_ppx" {with-dev-setup & >= "2.8.3"}
"commandlang" {= version}
"cmdlang" {= version}
"core" {>= "v0.17" & < "v0.18"}
"err" {= version}
"ppx_compare" {>= "v0.17" & < "v0.18"}
"ppx_enumerate" {>= "v0.17" & < "v0.18"}
"ppx_expect" {>= "v0.17" & < "v0.18"}
"ppx_hash" {>= "v0.17" & < "v0.18"}
"ppx_here" {>= "v0.17" & < "v0.18"}
"ppx_js_style" {with-dev-setup & >= "v0.17" & < "v0.18"}
"ppx_let" {>= "v0.17" & < "v0.18"}
"ppx_sexp_conv" {>= "v0.17" & < "v0.18"}
"ppx_sexp_value" {>= "v0.17" & < "v0.18"}
Expand All @@ -42,4 +39,4 @@ build: [
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/mbarbin/commandlang.git"
dev-repo: "git+https://github.com/mbarbin/cmdlang.git"
15 changes: 6 additions & 9 deletions commandlang-to-climate.opam → cmdlang-to-climate.opam
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Convert commandlang Parsers to climate"
synopsis: "Convert cmdlang Parsers to climate"
maintainer: ["Mathieu Barbin"]
authors: ["Mathieu Barbin"]
license: "MIT"
homepage: "https://github.com/mbarbin/commandlang"
doc: "https://mbarbin.github.io/commandlang/"
bug-reports: "https://github.com/mbarbin/commandlang/issues"
homepage: "https://github.com/mbarbin/cmdlang"
doc: "https://mbarbin.github.io/cmdlang/"
bug-reports: "https://github.com/mbarbin/cmdlang/issues"
depends: [
"dune" {>= "3.16"}
"ocaml" {>= "5.2"}
"ocamlformat" {with-dev-setup & = "0.26.2"}
"bisect_ppx" {with-dev-setup & >= "2.8.3"}
"climate" {= "0.0.1~preview-0.1"}
"commandlang" {= version}
"cmdlang" {= version}
"err" {= version}
"ppx_js_style" {with-dev-setup & >= "v0.17" & < "v0.18"}
"odoc" {with-doc}
]
build: [
Expand All @@ -32,4 +29,4 @@ build: [
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/mbarbin/commandlang.git"
dev-repo: "git+https://github.com/mbarbin/cmdlang.git"
32 changes: 32 additions & 0 deletions cmdlang-to-cmdliner.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Convert cmdlang Parsers to cmdliner"
maintainer: ["Mathieu Barbin"]
authors: ["Mathieu Barbin"]
license: "MIT"
homepage: "https://github.com/mbarbin/cmdlang"
doc: "https://mbarbin.github.io/cmdlang/"
bug-reports: "https://github.com/mbarbin/cmdlang/issues"
depends: [
"dune" {>= "3.16"}
"ocaml" {>= "5.2"}
"cmdliner" {= "1.3.0"}
"cmdlang" {= version}
"err" {= version}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/mbarbin/cmdlang.git"
11 changes: 4 additions & 7 deletions commandlang.opam → cmdlang.opam
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ synopsis: "Declarative Command-line Parsing for OCaml"
maintainer: ["Mathieu Barbin"]
authors: ["Mathieu Barbin"]
license: "MIT"
homepage: "https://github.com/mbarbin/commandlang"
doc: "https://mbarbin.github.io/commandlang/"
bug-reports: "https://github.com/mbarbin/commandlang/issues"
homepage: "https://github.com/mbarbin/cmdlang"
doc: "https://mbarbin.github.io/cmdlang/"
bug-reports: "https://github.com/mbarbin/cmdlang/issues"
depends: [
"dune" {>= "3.16"}
"ocaml" {>= "5.2"}
"ocamlformat" {with-dev-setup & = "0.26.2"}
"bisect_ppx" {with-dev-setup & >= "2.8.3"}
"ppx_js_style" {with-dev-setup & >= "v0.17" & < "v0.18"}
"odoc" {with-doc}
]
build: [
Expand All @@ -29,4 +26,4 @@ build: [
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/mbarbin/commandlang.git"
dev-repo: "git+https://github.com/mbarbin/cmdlang.git"
35 changes: 0 additions & 35 deletions commandlang-to-cmdliner.opam

This file was deleted.

2 changes: 1 addition & 1 deletion doc/blog/2024-08-07-hello/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors: [mbarbin]
tags: [hello]
---

Hello! I've just launched a blog section within the commandlang documentation, powered by Docusaurus. This new space is designed to keep you updated with all things related to commandlang. Stay tuned for more updates and insights. Happy reading!
Hello! I've just launched a blog section within the cmdlang documentation, powered by Docusaurus. This new space is designed to keep you updated with all things related to cmdlang. Stay tuned for more updates and insights. Happy reading!
2 changes: 1 addition & 1 deletion doc/blog/authors.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mbarbin:
name: Mathieu Barbin
title: Author & Maintainer of commandlang
title: Author & Maintainer of cmdlang
url: https://github.com/mbarbin
image_url: https://github.com/mbarbin.png
10 changes: 5 additions & 5 deletions doc/docs/explanation/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Explanation

Welcome to the Explanation section of the `commandlang` documentation. Here, we delve into the details of how `commandlang` works, its design principles, and our future plans. This section is intended to provide a deeper understanding of the project for developers and contributors.
Welcome to the Explanation section of the `cmdlang` documentation. Here, we delve into the details of how `cmdlang` works, its design principles, and our future plans. This section is intended to provide a deeper understanding of the project for developers and contributors.

## Architecture

`commandlang` is composed of several parts:
`cmdlang` is composed of several parts:

- **Core Specification Language**: A kernel command-line parsing specification language written as an OCaml EDSL.
- **OCaml Library**: Exposes a single module, `Commandlang.Command`, with no dependencies, to build command-line parsers in total abstraction using ergonomic helpers.
- **Translation Libraries**: Convert `commandlang` parsers at runtime into `cmdliner`, `core.command`, or `climate` parsers.
- **OCaml Library**: Exposes a single module, `Cmdlang.Command`, with no dependencies, to build command-line parsers in total abstraction using ergonomic helpers.
- **Translation Libraries**: Convert `cmdlang` parsers at runtime into `cmdliner`, `core.command`, or `climate` parsers.

## Experimental Status

`commandlang` is currently under construction and considered experimental. We are actively seeking feedback to validate our design and engage with other declarative command-line enthusiasts.
`cmdlang` is currently under construction and considered experimental. We are actively seeking feedback to validate our design and engage with other declarative command-line enthusiasts.

## Future Plans

Expand Down
6 changes: 3 additions & 3 deletions doc/docs/explanation/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

We are currently in an exploratory phase and need to easily update our internal representations. Adding too many helpers now would complicate this process. Therefore, we aim to balance providing enough functionality for early trials while keeping the core minimal. We plan to revisit this later with user feedback.

#### Why isn't Commandlang's Arg parser an arrow?
#### Why isn't Cmdlang's Arg parser an arrow?

We are uncertain if all targeted models support branching. When writing a CLI for an OCaml program, encoding variants in the CLI can create a clear mapping between the user interface and the internal implementation. However, this approach might complicate the CLI. Commandlang aims to operate at the intersection of its targeted backends, which could be a significant constraint if you need functionality only offered in a specific backend. This is an area for future development. If you need a feature that is only available in another CLI library, commandlang might not be a good fit for your project.
We are uncertain if all targeted models support branching. When writing a CLI for an OCaml program, encoding variants in the CLI can create a clear mapping between the user interface and the internal implementation. However, this approach might complicate the CLI. Cmdlang aims to operate at the intersection of its targeted backends, which could be a significant constraint if you need functionality only offered in a specific backend. This is an area for future development. If you need a feature that is only available in another CLI library, cmdlang might not be a good fit for your project.

## Other Questions

Feel free to ask any other questions about commandlang.
Feel free to ask any other questions about cmdlang.
Loading

0 comments on commit 8a4117f

Please sign in to comment.