DUNE-INIT(1)
π¦ DUNE-INIT(1) β bestie edition
okay so. you're looking at dune-init from the Dune Manual, and honestly? it's giving project scaffolding main character energy. it's the command group that initializes Dune components. that's it. that's the job. and it does it flawlessly, no cap. π
β¨ NAME β¨
dune-init β the command group for initializing Dune components, periodt.
πΈ SYNOPSIS πΈ
dune init project NAME [PATH] [OPTION]...
dune init executable NAME [PATH] [OPTION]...
dune init library NAME [PATH] [OPTION]...
dune init test NAME [PATH] [OPTION]...
dune init start-file [PATH]
π DESCRIPTION π
So here's the vibe. When you run:
dune init COMPONENT NAME [PATH] [OPTION]...
β¦it initializes a brand new dune configuration for a component. The kind of component is whatever the subcommand COMPONENT says it is, it's named NAME, and its fields get filled in based on the OPTIONs you hand it. that's literally the whole deal.
Want the tea on any one subcommand? Run it with --help and it'll spill the details on its supported arguments. π«
Now, the optional PATH β if you give one, it must be a path to a directory, because that's where the component gets created. If you don't give one, it gets created in a child of the current working directory, and that child is called NAME. And if you wanna init a component in the current working directory itself? Use . as the PATH. iconic behavior, honestly.
Also super cute: any prefix of a COMMAND's name works in place of the full name. yes bestie, shortcuts are built in (it's illustrated up in the synopsis if you wanna peek).
For more deets, go read https://dune.readthedocs.io/en/stable/usage.html#initializing-components π
π COMMANDS π
executable [OPTION]β¦ NAME [PATH]β a binary executable. that's what it is. a program. she runs.library [OPTION]β¦ NAME [PATH]β an OCaml library. for when you have reusable code and you want everyone to know about it.project [OPTION]β¦ NAME [PATH]β a project is a predefined composition of components arranged in a standard directory structure. the kind of project you get is decided by the value of the--kindflag, and it defaults to an executable project β which is itself composed of a library, an executable, and a test component. it's a whole little ecosystem, a full outfit. πstart-file [OPTION]β¦ [PATH]β writes the standardstart/dunefile. that's the whole job and she does it well.test [OPTION]β¦ NAME [PATH]β a test harness. and psst, for inline tests you use the--inline-testsflag along with the other component kinds. π§ͺ
π COMMON OPTIONS π
--help[=FMT](default=auto) β shows this help in formatFMT.FMThas to be one ofauto,pager,grofforplain. withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined. yes, it checks. she's considerate like that.--versionβ shows version information. the classic.
π₯ EXIT STATUS π₯
dune init exits with:
0β on success. slay. π1β if an error happened. π130β if it was interrupted by a signal. π
π EXAMPLES π
- Generate a project skeleton for an executable named
myprojin a new directory namedmyproj, depending on theboslibrary and using inline tests along withppx_inline_test:
dune init project myproj --libs bos --ppx ppx_inline_test --inline-tests
- Configure an executable component named
myexein a dune file in the current directory:
dune init executable myexe
- Configure a library component named
mylibin a dune file in the./srcdirectory depending on thecoreandcmdlinerlibraries, theppx_letandppx_inline_testpreprocessors, and declared as using inline tests:
dune init library mylib src --libs core,cmdliner --ppx ppx_let,ppx_inline_test --inline-tests
- Configure a test component named
mytestin a dune file in the./testdirectory that depends onmylib:
dune init test mytest test --libs mylib
- Write the standard
start/dunehelper file:
dune init start-file
π SEE ALSO π
dune(1)β go say hi to the main page bestie, she knows everything. π«Ά
and that's the whole page, loves! this was Dune 3.24.1, and yes, it's giving iconic. go forth and dune init something cute. πβ¨
π¦ 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