DUNE-SUBST(1)
π DUNE-SUBST(1) π
okay bestie, welcome to the Dune Manual β¨ this one's called dune-subst, and it's the lil glow-up fairy for your source files π§
β¨ NAME β¨
dune-subst β swaps out watermarks in your source files π
πΈ SYNOPSIS πΈ
dune subst [--build-info] [OPTION]β¦
π¦ DESCRIPTION π¦
So basically, dune subst goes through your source files and replaces %%ID%% strings β same vibe as what topkg does in its default configuration. no cap π
heads up tho: this command is only meant to be called when a user pins a package to its development version. it's not a casual everyday thing, it's a special-occasion thing π
What it's doing: it swaps %%VERSION%% strings for the version it gets from the vcs. Currently only git is supported, and the version comes straight from the output of:
$ git describe --always --dirty --abbrev=7
And dune subst substitutes exactly the variables that topkg substitutes with the default configuration:
%%NAME%%β the name of the project (pulled from thedune-projectfile)%%VERSION%%β output ofgit describe --always --dirty --abbrev=7%%VERSION_NUM%%β same as%%VERSION%%but with a potential leading'v'or'V'dropped%%VCS_COMMIT_ID%%β commit hash from the vcs%%PKG_MAINTAINER%%β contents of themaintainer:field from the opam file%%PKG_AUTHORS%%β contents of theauthors:field from the opam file%%PKG_HOMEPAGE%%β contents of thehomepage:field from the opam file%%PKG_ISSUES%%β contents of theissues:field from the opam file%%PKG_DOC%%β contents of thedoc:field from the opam file%%PKG_LICENSE%%β contents of thelicense:field from the opam file%%PKG_REPO%%β contents of therepo:field from the opam file
So like, when you want dune subst to run at the moment your package gets pinned, you just add this line to the build: field of your opam file:
[dune "subst"] {pinned}
periodt π
β οΈ lowkey important: this command is meant to be called only from opam files, and it behaves a bit differently from other dune commands. specifically, it doesn't try to detect the root, so you must call it from the root of the project. like, from the actual root. not a subdirectory. from the root, bestie π
π OPTIONS π
--build-infoβ show build information. that's the whole thing π«Ά
π COMMON OPTIONS π
these ones are common to all commands, so they're basically the shared friend group of every dune command π
--debug-backtracesβ always print exception backtraces. no hiding, full drama π--help[=FMT](default=auto) β show this help in formatFMT. the valueFMThas to be one ofauto,pager,grofforplain. withauto, the format becomespagerorplainwhenever theTERMenv var isdumbor undefined. slay β¨--versionβ show version information πΈ
π MORE HELP π
Want help on just one command? run:
`dune COMMAND --help'
for help on a single command π
β EXIT STATUS β
dune subst exits with:
0β on success π₯³1β if an error happened π130β if it was interrupted by a signal π
π BUGS π
found a bug? check bug reports at https://github.com/ocaml/dune/issues β go be a main character and file it π«Ά
π SEE ALSO π
okay that's the whole thing, bestie!! go substitute those watermarks, you've got this π
later, legend β this was Dune 3.24.1, the DUNE-SUBST(1) page, and yes it ate β¨π
π
π¦ where this page comes from
- ubuntu stonking: ocaml-dune 3.24.1-4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms