1DUNE-FMT(1)                       Dune Manual                      DUNE-FMT(1)
2
3
4

NAME

6       dune-fmt - Format source code.
7

SYNOPSIS

9       dune fmt [OPTION]…
10

DESCRIPTION

12       dune fmt runs the formatter on the source code. The formatter is
13       automatically selected. ocamlformat is used to format OCaml source code
14       (*.ml and *.mli files) and refmt is used to format Reason source code
15       (*.re and *.rei files).
16

OPTIONS

18       --action-stderr-on-success=VAL
19           Same as --action-stdout-on-success but for the standard output for
20           error messages. A good default for large mono-repositories is
21           --action-stdout-on-success=swallow
22           --action-stderr-on-success=must-be-empty. This ensures that a
23           successful build has a "clean" empty output.
24
25       --action-stdout-on-success=VAL
26           Specify how to deal with the standard output of actions when they
27           succeed. Possible values are: print to just print it to Dune's
28           output, swallow to completely ignore it and must-be-empty to
29           enforce that the action printed nothing. With must-be-empty, Dune
30           will consider that the action failed if it printed something to its
31           standard output. The default is print.
32
33       --build-info
34           Show build information.
35
36       --display-separate-messages
37           Separate error messages with a blank line.
38
39       --error-reporting=VAL (absent=deterministic)
40           Controls when the build errors are reported. early - report errors
41           as soon as they are discovered. deterministic - report errors at
42           the end of the build in a deterministic order. twice - report each
43           error twice: once as soon as the error is discovered and then again
44           at the end of the build, in a deterministic order.
45
46       -f, --force
47           Force actions associated to aliases to be re-executed even if their
48           dependencies haven't changed.
49
50       --file-watcher=VAL (absent=automatic)
51           Mechanism to detect changes in the source. Automatic to make dune
52           run an external program to detect changes. Manual to notify dune
53           that files have changed manually."
54
55       --passive-watch-mode
56           Similar to [--watch], but only start a build when instructed
57           externally by an RPC.
58
59       --react-to-insignificant-changes
60           react to insignificant file system changes; this is only useful for
61           benchmarking dune
62
63       --sandbox=VAL (absent DUNE_SANDBOX env)
64           Sandboxing mode to use by default. Some actions require a certain
65           sandboxing mode, so they will ignore this setting. The allowed
66           values are: none, symlink, copy, hardlink.
67
68       -w, --watch
69           Instead of terminating build after completion, wait continuously
70           for file changes.
71
72       --wait-for-filesystem-clock
73           Dune digest file contents for better incrementally. These digests
74           are themselves cached. In some cases, Dune needs to drop some
75           digest cache entries in order for things to be reliable. This
76           option makes Dune wait for the file system clock to advance so that
77           it doesn't need to drop anything. You should probably not care
78           about this option; it is mostly useful for Dune developers to make
79           Dune tests of the digest cache more reproducible.
80

COMMON OPTIONS

82       These options are common to all commands.
83
84       --always-show-command-line
85           Always show the full command lines of programs executed by dune
86
87       --auto-promote
88           Automatically promote files. This is similar to running dune
89           promote after the build.
90
91       --build-dir=FILE (absent DUNE_BUILD_DIR env)
92           Specified build directory. _build if unspecified
93
94       --cache=VAL (absent DUNE_CACHE env)
95           Enable or disable Dune cache (either enabled or disabled). Default
96           is `disabled'.
97
98       --cache-check-probability=VAL (absent DUNE_CACHE_CHECK_PROBABILITY env)
99           Check build reproducibility by re-executing randomly chosen rules
100           and comparing their results with those stored in Dune cache. Note:
101           by increasing the probability of such checks you slow down the
102           build. The default probability is zero, i.e. no rules are checked.
103
104       --cache-storage-mode=VAL (absent DUNE_CACHE_STORAGE_MODE env)
105           Dune cache storage mode (one of auto, hardlink or copy). Default is
106           `auto'.
107
108       --config-file=FILE
109           Load this configuration file instead of the default one.
110
111       --debug-artifact-substitution
112           Print debugging info about artifact substitution
113
114       --debug-backtraces
115           Always print exception backtraces.
116
117       --debug-cache=VAL
118           Show debug messages on cache misses for the given cache layers.
119           Value is a comma-separated list of cache layer names. All available
120           cache layers: shared,workspace-local,fs.
121
122       --debug-dependency-path
123           In case of error, print the dependency path from the targets on the
124           command line to the rule that failed.
125
126       --debug-digests
127           Explain why Dune decides to re-digest some files
128
129       --debug-load-dir
130           Print debugging info about directory loading
131
132       --debug-store-digest-preimage
133           Store digest preimage for all computed digests, so that it's
134           possible to reverse them later, for debugging. The digests are
135           stored in the shared cache (see --cache flag) as values, even if
136           cache is otherwise disabled. This should be used only for
137           debugging, since it's slow and it litters the shared cache.
138
139       --default-target=TARGET (absent=@@default)
140           Set the default target that when none is specified to dune build.
141
142       --diff-command=VAL (absent DUNE_DIFF_COMMAND env)
143           Shell command to use to diff files. Use - to disable printing the
144           diff.
145
146       --disable-promotion (absent DUNE_DISABLE_PROMOTION env)
147           Disable all promotion rules
148
149       --display=MODE
150           Control the display mode of Dune. See dune-config(5) for more
151           details. Valid values for this option are progress, verbose, short,
152           quiet or tui.
153
154       --dump-gc-stats=FILE
155           Dump the garbage collector stats to a file after the build is
156           complete.
157
158       --dump-memo-graph=FILE
159           Dumps the dependency graph to a file after the build is complete
160
161       --dump-memo-graph-format=FORMAT (absent=gexf)
162           File format to be used when dumping dependency graph
163
164       --dump-memo-graph-with-timing
165           With --dump-memo-graph, will re-run each cached node in the Memo
166           graph after building and include the runtime in the output. Since
167           all nodes contain a cached value, this will measure just the
168           runtime of each node
169
170       --help[=FMT] (default=auto)
171           Show this help in format FMT. The value FMT must be one of auto,
172           pager, groff or plain. With auto, the format is pager or plain
173           whenever the TERM env var is dumb or undefined.
174
175       --ignore-promoted-rules
176           Ignore rules with (mode promote), except ones with (only ...). The
177           variable %{ignoring_promoted_rules} in dune files reflects whether
178           this option was passed or not.
179
180       --instrument-with=BACKENDS (absent DUNE_INSTRUMENT_WITH env)
181           "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
182           list of library names, each one of which must declare an
183           instrumentation backend.
184
185       -j JOBS
186           Run no more than JOBS commands simultaneously.
187
188       --no-buffer
189           Do not buffer the output of commands executed by dune. By default
190           dune buffers the output of subcommands, in order to prevent
191           interleaving when multiple commands are executed in parallel.
192           However, this can be an issue when debugging long running tests.
193           With --no-buffer, commands have direct access to the terminal. Note
194           that as a result their output won't be captured in the log file.
195           You should use this option in conjunction with -j 1, to avoid
196           interleaving. Additionally you should use --verbose as well, to
197           make sure that commands are printed before they are being executed.
198
199       --no-config
200           Do not load the configuration file
201
202       --no-print-directory
203           Suppress "Entering directory" messages
204
205       --only-packages=PACKAGES
206           Ignore stanzas referring to a package that is not in PACKAGES.
207           PACKAGES is a comma-separated list of package names. Note that this
208           has the same effect as deleting the relevant stanzas from dune
209           files. It is mostly meant for releases. During development, it is
210           likely that what you want instead is to build a particular
211           <package>.install target.
212
213       -p PACKAGES, --for-release-of-packages=PACKAGES (required)
214           Shorthand for --release --only-packages PACKAGE. You must use this
215           option in your <package>.opam files, in order to build only what's
216           necessary when your project contains multiple packages as well as
217           getting reproducible builds.
218
219       --print-metrics
220           Print out various performance metrics after every build
221
222       --profile=VAL (absent DUNE_PROFILE env)
223           Select the build profile, for instance dev or release. The default
224           is dev.
225
226       --promote-install-files[=VAL] (default=true)
227           Promote the generated <package>.install files to the source tree
228
229       --release
230           Put dune into a reproducible release mode. This is in fact a
231           shorthand for --root . --ignore-promoted-rules --no-config
232           --profile release --always-show-command-line
233           --promote-install-files --default-target @install
234           --require-dune-project-file. You should use this option for release
235           builds. For instance, you must use this option in your
236           <package>.opam files. Except if you already use -p, as -p implies
237           this option.
238
239       --require-dune-project-file[=VAL] (default=true)
240           Fail if a dune-project file is missing.
241
242       --root=DIR
243           Use this directory as workspace root instead of guessing it. Note
244           that this option doesn't change the interpretation of targets given
245           on the command line. It is only intended for scripts.
246
247       --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
248           Store original source location in dune-package metadata
249
250       --terminal-persistence=MODE
251           Changes how the log of build results are displayed to the console
252           between rebuilds while in --watch mode. Supported modes: preserve,
253           clear-on-rebuild, clear-on-rebuild-and-flush-history.
254
255       --trace-extended
256           Output extended trace data (requires trace-file)
257
258       --trace-file=FILE
259           Output trace data in catapult format (compatible with
260           chrome://tracing)
261
262       --verbose
263           Same as --display verbose
264
265       --version
266           Show version information.
267
268       --watch-exclusions=REGEX
269           Adds a POSIX regular expression that will exclude matching
270           directories from `dune build --watch`. The option
271           --watch-exclusions can be repeated to add multiple exclusions.
272           Semicolons can be also used as a separator. If no exclusions are
273           provided, then a standard set of exclusions is used; however, if
274           one or more --watch-exclusions are used, none of the standard
275           exclusions are used. The standard exclusions are: ^_opam /_opam
276           ^_esy /_esy ^\.#.* /\.#.* ~$ ^#[^#]*#$ /#[^#]*#$ ^4913$ /4913$
277           /.git /.hg :/windows
278
279       --workspace=FILE (absent DUNE_WORKSPACE env)
280           Use this specific workspace file instead of looking it up.
281
282       -x VAL
283           Cross-compile using this toolchain.
284

MORE HELP

286       Use `dune COMMAND --help' for help on a single command.
287

EXIT STATUS

289       fmt exits with the following status:
290
291       0   on success.
292
293       1   if an error happened.
294
295       130 if it was interrupted by a signal.
296

ENVIRONMENT

298       These environment variables affect the execution of fmt:
299
300       CLICOLOR
301           If different than 0, ANSI colors are supported and should be used
302           when the program isn’t piped. If equal to 0, don’t output ANSI
303           color escape codes
304
305       CLICOLOR_FORCE
306           If different than 0, ANSI colors should be enabled no matter what.
307
308       DUNE_BUILD_DIR
309           Specified build directory. _build if unspecified
310
311       DUNE_CACHE
312           Enable or disable Dune cache (either enabled or disabled). Default
313           is `disabled'.
314
315       DUNE_CACHE_CHECK_PROBABILITY
316           Check build reproducibility by re-executing randomly chosen rules
317           and comparing their results with those stored in Dune cache. Note:
318           by increasing the probability of such checks you slow down the
319           build. The default probability is zero, i.e. no rules are checked.
320
321       DUNE_CACHE_STORAGE_MODE
322           Dune cache storage mode (one of auto, hardlink or copy). Default is
323           `auto'.
324
325       DUNE_DIFF_COMMAND
326           Shell command to use to diff files. Use - to disable printing the
327           diff.
328
329       DUNE_DISABLE_PROMOTION
330           Disable all promotion rules
331
332       DUNE_INSTRUMENT_WITH
333           "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
334           list of library names, each one of which must declare an
335           instrumentation backend.
336
337       DUNE_PROFILE
338           Build profile. dev if unspecified or release if -p is set.
339
340       DUNE_SANDBOX
341           Sandboxing mode to use by default. (see --sandbox)
342
343       DUNE_STORE_ORIG_SOURCE_DIR
344           Store original source location in dune-package metadata
345
346       DUNE_WORKSPACE
347           Use this specific workspace file instead of looking it up.
348

BUGS

350       Check bug reports at https://github.com/ocaml/dune/issues
351

SEE ALSO

353       dune(1)
354
355
356
357Dune n/a                                                           DUNE-FMT(1)
Impressum