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 the dune-project file)
  • %%VERSION%% β€” output of git 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 the maintainer: field from the opam file
  • %%PKG_AUTHORS%% β€” contents of the authors: field from the opam file
  • %%PKG_HOMEPAGE%% β€” contents of the homepage: field from the opam file
  • %%PKG_ISSUES%% β€” contents of the issues: field from the opam file
  • %%PKG_DOC%% β€” contents of the doc: field from the opam file
  • %%PKG_LICENSE%% β€” contents of the license: field from the opam file
  • %%PKG_REPO%% β€” contents of the repo: 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 format FMT. the value FMT has to be one of auto, pager, groff or plain. with auto, the format becomes pager or plain whenever the TERM env var is dumb or 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:

  1. 0 β€” on success πŸ₯³
  2. 1 β€” if an error happened πŸ’€
  3. 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 πŸ‘‘

dune(1)


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