Improve Core Commands distributed with opam
  • OCaml 57.4%
  • Dune 24.8%
  • Makefile 17.8%
Find a file
2024-08-22 22:49:09 +02:00
.github Upgrade other GitHub ocaml/setup-ocaml actions to v3 2024-07-25 18:52:15 +02:00
.vscode init 2023-11-03 11:57:01 +01:00
src prepare 0.0.1 2023-11-03 12:15:40 +01:00
test prepare 0.0.1 2023-11-03 12:15:40 +01:00
.gitattributes init 2023-11-03 11:57:01 +01:00
.gitignore Update .gitignore 2024-04-10 14:57:45 +02:00
.ocamlformat Upgrade ocamlformat to 0.26.2 2024-04-30 14:48:29 +02:00
CHANGES.md Prepare changelog 2024-07-26 10:58:03 +02:00
command-unix-for-opam.opam Upgrade ppxlib to 0.33 2024-07-25 18:52:16 +02:00
dune init 2023-11-03 11:57:01 +01:00
dune-project Upgrade ppxlib to 0.33 2024-07-25 18:52:16 +02:00
LICENSE init 2023-11-03 11:57:01 +01:00
Makefile init 2023-11-03 11:57:01 +01:00
README.md Update README.md 2024-08-22 22:49:09 +02:00

command-unix-for-opam

CI Status

⚠️ This repository is now a public archive.

I ended up going a different route to distribute OCaml clis via opam: https://github.com/mbarbin/commandlang

I have stopped developping the command-unix-for-opam project and will not be maintaining it forward.


Motivations

This util library is meant to improve compatibility of core commands meant to be distributed with the opam package manager.

In particular, if a command is simply run with Command_unix.run, it ends up in the distribution with no special support for options -version and version:

$ cmd version
((build_time(1970-01-01 01:00:00.000000+01:00))(x_library_inlining false)(portable_int63 true)(dynlinkable_code false)(ocaml_version"")(executable_path"")(build_system""))
NO_VERSION_UTIL

$ cmd -version
NO_VERSION_UTIL

This library is meant to improve this, by joining the dots between Command_unix's version and dune-build-info, so that version refers to the version of the package distribution, for example:

$ opam install my-core-cmd.2.1.3
$ my-core-cmd -version
2.1.3

Down the road?

Since dune-build-info and core_unix.command_unix are both maintained by Jane Street Group, it is possible an integration of this kind will take place directly in core_unix.command_unix at a later point, making this library obsolete. TBD.

Usage

The current usage is to add a dependency to command-unix-for-opam in the bin's dune file, and simply replace Command_unix.run by Command_unix_for_opam.run in your main.ml.

- let () = Command_unix.run My_core_cmd.command
+ let () = Command_unix_for_opam.run My_core_cmd.command

Code documentation

The code documentation of the latest release is built with odoc and published to GitHub pages here.