This commit is contained in:
parent
b1fbebfcfa
commit
748d199b9c
8 changed files with 721 additions and 51 deletions
673
fmt
Normal file
673
fmt
Normal file
|
|
@ -0,0 +1,673 @@
|
|||
[4mOCAMLFORMAT[24m(1) Ocamlformat Manual [4mOCAMLFORMAT[24m(1)
|
||||
|
||||
[1mNAME[0m
|
||||
ocamlformat - A tool to format OCaml code.
|
||||
|
||||
[1mSYNOPSIS[0m
|
||||
[1mocamlformat [22m[[4mOPTION[24m]… [[4mSRC[24m]…
|
||||
|
||||
[1mDESCRIPTION[0m
|
||||
[1mocamlformat [22mautomatically formats OCaml code.
|
||||
|
||||
[1mOPTIONS (CODE FORMATTING STYLE)[0m
|
||||
Unless otherwise noted, any option [1m--[4m[22moption[24m[1m=[4m[22mVAL[24m detailed in this
|
||||
section can be set in many ways, its value is determined in the
|
||||
following order (of increasing priority): the default value is used if
|
||||
no other value is specified. The value of a boolean option [1m--foo [22mor
|
||||
[1m--no-foo [22mcan be modified in an [1m.ocamlformat [22mconfiguration file with
|
||||
'[1mfoo = [22m{[1mtrue[22m,[1mfalse[22m}', it can be done for any other option with an
|
||||
'[1moption = [4m[22mVAL[24m' line (*), or using the OCAMLFORMAT environment variable:
|
||||
[1mOCAMLFORMAT=[4m[22moption[24m[1m=[4m[22mVAL[24m[1m,[22m...[1m,[4m[22moption[24m[1m=[4m[22mVAL[24m, or as an optional parameter on
|
||||
the command line, or with a global [1m[@@@ocamlformat "[4m[22moption[24m[1m=[4m[22mVAL[24m[1m"][0m
|
||||
attribute in the processed file, or with an [1m[@@ocamlformat[0m
|
||||
[1m"[4m[22moption[24m[1m=[4m[22mVAL[24m[1m"] [22mattribute on expression in the processed file.
|
||||
|
||||
(*) [1m.ocamlformat [22mfiles in current and all ancestor directories for each
|
||||
input file are used, applied from top to bottom, overriding the
|
||||
settings each time a file is applied, stopping at the project root. If
|
||||
no project root and no [1mocamlformat [22mfile has been found, and if the
|
||||
option [1menable-outside-detected-project [22mis set, the global [1mocamlformat[0m
|
||||
file defined in [1m$XDG_CONFIG_HOME [22m(or in [1m$HOME/.config [22mif
|
||||
[1m$XDG_CONFIG_HOME [22mis undefined) is used.
|
||||
|
||||
If the [1mdisable [22moption is not set, an [1m.ocamlformat-ignore [22mfile specifies
|
||||
files that OCamlFormat should ignore. Each line in an
|
||||
[1m.ocamlformat-ignore [22mfile specifies a filename relative to the directory
|
||||
containing the [1m.ocamlformat-ignore [22mfile. Shell-style regular
|
||||
expressions are supported. Lines starting with [1m# [22mare ignored and can be
|
||||
used as comments.
|
||||
|
||||
If the [1mdisable [22moption is set, an [1m.ocamlformat-enable [22mfile specifies
|
||||
files that OCamlFormat should format even when the [1mdisable [22moption is
|
||||
set. Each line in an [1m.ocamlformat-enable [22mfile specifies a filename
|
||||
relative to the directory containing the [1m.ocamlformat-enable [22mfile.
|
||||
Shell-style regular expressions are supported. Lines starting with [1m#[0m
|
||||
are ignored and can be used as comments.
|
||||
|
||||
[1m--assignment-operator[22m=[4m{end-line|begin-line}[0m
|
||||
Position of the assignment operator. [1mend-line [22mpositions assignment
|
||||
operators (‘:=‘ and ‘<-‘) at the end of the line and breaks after
|
||||
it if the whole assignment expression does not fit on a single
|
||||
line. [1mbegin-line [22mpositions assignment operators (‘:=‘ and ‘<-‘) at
|
||||
the beginning of the line and breaks before it if the whole
|
||||
assignment expression does not fit on a single line. The default
|
||||
value is [1mend-line[22m.
|
||||
|
||||
[1m--break-before-in[22m=[4m{fit-or-vertical|auto}[0m
|
||||
Whether the line should break before the [4min[24m keyword of a [4mlet[0m
|
||||
binding. [1mfit-or-vertical [22mwill always break the line before the [4min[0m
|
||||
keyword if the whole [4mlet[24m binding does not fit on a single line.
|
||||
[1mauto [22mwill only break the line if the [4min[24m keyword does not fit on the
|
||||
previous line. The default value is [1mfit-or-vertical[22m.
|
||||
|
||||
[1m--break-cases[22m=[4m{fit|nested|toplevel|fit-or-vertical|vertical|all}[0m
|
||||
Break pattern match cases. Specifying [1mfit [22mlets pattern matches
|
||||
break at the margin naturally. [1mnested [22mforces a break after nested
|
||||
or-patterns to highlight the case body. Note that with [1mnested[22m, the
|
||||
[1mindicate-nested-or-patterns [22moption is not needed, and so ignored.
|
||||
[1mtoplevel [22mforces top-level cases (i.e. not nested or-patterns) to
|
||||
break across lines, otherwise break naturally at the margin.
|
||||
[1mfit-or-vertical [22mtries to fit all or-patterns on the same line,
|
||||
otherwise breaks. [1mvertical [22mvertically breaks branches. [1mall [22mforces
|
||||
all pattern matches to break across lines. The default value is
|
||||
[1mfit[22m.
|
||||
|
||||
[1m--break-collection-expressions[22m=[4m{fit-or-vertical|wrap}[0m
|
||||
Break collection expressions (lists and arrays) elements by
|
||||
elements. [1mfit-or-vertical [22mvertically breaks expressions if they do
|
||||
not fit on a single line. [1mwrap [22mwill group simple expressions and
|
||||
try to format them in a single line. The default value is
|
||||
[1mfit-or-vertical[22m.
|
||||
|
||||
[1m--break-colon[22m=[4m{after|before}[0m
|
||||
Break before or after colon in value binding declarations and type
|
||||
constraints. [1mafter [22mbreaks after the colon. [1mbefore [22mbreaks before the
|
||||
colon. The default value is [1mafter[22m.
|
||||
|
||||
[1m--break-fun-decl[22m=[4m{wrap|fit-or-vertical|smart}[0m
|
||||
Style for function declarations and types. [1mwrap [22mbreaks only if
|
||||
necessary. [1mfit-or-vertical [22mvertically breaks arguments if they do
|
||||
not fit on a single line. [1msmart [22mis like [1mfit-or-vertical [22mbut try to
|
||||
fit arguments on their line if they fit. The default value is [1mwrap[22m.
|
||||
|
||||
[1m--break-fun-sig[22m=[4m{wrap|fit-or-vertical|smart}[0m
|
||||
Style for function signatures. [1mwrap [22mbreaks only if necessary.
|
||||
[1mfit-or-vertical [22mvertically breaks arguments if they do not fit on a
|
||||
single line. [1msmart [22mis like [1mfit-or-vertical [22mbut try to fit arguments
|
||||
on their line if they fit. The default value is [1mwrap[22m.
|
||||
|
||||
[1m--break-infix[22m=[4m{wrap|fit-or-vertical|wrap-or-vertical}[0m
|
||||
Break sequence of infix operators. [1mwrap [22mwill group simple
|
||||
expressions and try to format them in a single line.
|
||||
[1mfit-or-vertical [22mvertically breaks expressions if they do not fit on
|
||||
a single line. [1mwrap-or-vertical [22mbehaves like [1mwrap [22mfor high
|
||||
precedence operators and behaves like [1mfit-or-vertical [22mfor low
|
||||
precedence operators. The default value is [1mwrap[22m.
|
||||
|
||||
[1m--break-infix-before-func[0m
|
||||
Break infix operators whose right arguments are anonymous functions
|
||||
specially: do not break after the operator so that the first line
|
||||
of the function appears docked at the end of line after the
|
||||
operator. The flag is [1munset [22mby default.
|
||||
|
||||
[1m--break-separators[22m=[4m{after|before}[0m
|
||||
Break before or after separators such as ‘;‘ in list or record
|
||||
expressions. [1mafter [22mbreaks the expressions after the separator.
|
||||
[1mbefore [22mbreaks the expressions before the separator. The default
|
||||
value is [1mafter[22m.
|
||||
|
||||
[1m--break-sequences[0m
|
||||
Force sequence expressions to break irrespective of margin. The
|
||||
flag is [1mset [22mby default.
|
||||
|
||||
[1m--break-string-literals[22m=[4m{auto|never}[0m
|
||||
Break string literals. [1mauto [22mmode breaks lines at newlines and wraps
|
||||
string literals at the margin. [1mnever [22mmode formats string literals
|
||||
as they are parsed, in particular, with escape sequences expanded.
|
||||
The default value is [1mauto[22m.
|
||||
|
||||
[1m--break-struct[22m=[4m{force|natural}[0m
|
||||
Break struct-end module items. [1mforce [22mwill break struct-end phrases
|
||||
unconditionally. [1mnatural [22mwill break struct-end phrases naturally at
|
||||
the margin. The default value is [1mforce[22m.
|
||||
|
||||
[1m--cases-exp-indent[22m=[4mCOLS[0m
|
||||
Indentation of cases expressions ([4mCOLS[24m columns). See also the
|
||||
[1mcases-matching-exp-indent [22mand [1mnested-match [22moptions. The default
|
||||
value is [1m4[22m. Cannot be set in attributes.
|
||||
|
||||
[1m--cases-matching-exp-indent[22m=[4m{normal|compact}[0m
|
||||
Indentation of cases right-hand sides which are ‘match‘ or ‘try‘
|
||||
expressions. [1mnormal [22mindents as it would any other expression.
|
||||
[1mcompact [22mforces an indentation of 2, unless [1mnested-match [22mis set to
|
||||
[1malign [22mand we're on the last case. The default value is [1mnormal[22m.
|
||||
|
||||
[1m--disambiguate-non-breaking-match[0m
|
||||
Add parentheses around matching constructs that fit on a single
|
||||
line. The flag is [1munset [22mby default.
|
||||
|
||||
[1m--doc-comments[22m=[4m{after-when-possible|before-except-val|before}[0m
|
||||
Doc comments position. [1mafter-when-possible [22mputs doc comments after
|
||||
the corresponding code. This option has no effect on variant
|
||||
declarations because that would change their meaning and on
|
||||
structures, signatures and objects for readability.
|
||||
[1mbefore-except-val [22mputs doc comments before the corresponding code,
|
||||
but puts doc comments of [1mval [22mand [1mexternal [22mdeclarations after the
|
||||
corresponding declarations. [1mbefore [22mputs comments before the
|
||||
corresponding code. The default value is [1mafter-when-possible[22m.
|
||||
|
||||
[1m--doc-comments-padding[22m=[4mPADDING[0m
|
||||
Add [4mPADDING[24m spaces before doc comments in type declarations. The
|
||||
default value is [1m2[22m.
|
||||
|
||||
[1m--doc-comments-tag-only[22m=[4m{default|fit}[0m
|
||||
Position of doc comments with only tags. [1mdefault [22mmeans no special
|
||||
treatment. [1mfit [22mputs doc comments on the same line. The default
|
||||
value is [1mdefault[22m.
|
||||
|
||||
[1m--dock-collection-brackets[0m
|
||||
Dock the brackets of lists, arrays and records, so that when the
|
||||
collection does not fit on a single line the brackets are opened on
|
||||
the preceding line and closed on the following line. The flag is
|
||||
[1mset [22mby default.
|
||||
|
||||
[1m--exp-grouping[22m=[4m{parens|preserve}[0m
|
||||
Style of expression grouping. [1mparens [22mgroups expressions using
|
||||
parentheses. [1mpreserve [22mpreserves the original grouping syntax
|
||||
(parentheses or [4mbegin[24m/[4mend[24m). The default value is [1mparens[22m. Cannot be
|
||||
set in attributes.
|
||||
|
||||
[1m--extension-indent[22m=[4mCOLS[0m
|
||||
Indentation of items inside extension nodes ([4mCOLS[24m columns). The
|
||||
default value is [1m2[22m.
|
||||
|
||||
[1m--field-space[22m=[4m{loose|tight|tight-decl}[0m
|
||||
Whether or not to use a space between a field name and the
|
||||
punctuation symbol (‘:‘ or ‘=‘) preceding the rhs. This option
|
||||
affects records and objects. [1mloose [22muses a space. [1mtight [22mdoes not use
|
||||
a space. [1mtight-decl [22mis [1mtight [22mfor declarations and [1mloose [22mfor
|
||||
instantiations. The default value is [1mloose[22m.
|
||||
|
||||
[1m--function-indent[22m=[4mCOLS[0m
|
||||
Indentation of function cases ([4mCOLS[24m columns). The default value is
|
||||
[1m2[22m.
|
||||
|
||||
[1m--function-indent-nested[22m=[4m{never|always|auto}[0m
|
||||
Whether the [1mfunction-indent [22mparameter should be applied even when
|
||||
in a sub-block. [1mnever [22monly applies [1mfunction-indent [22mif the function
|
||||
block starts a line. [1malways [22malways apply [1mfunction-indent[22m. [1mauto[0m
|
||||
applies [1mfunction-indent [22mwhen seen fit. The default value is [1mnever[22m.
|
||||
|
||||
[1m--if-then-else[22m=[4m{compact|fit-or-vertical|vertical|keyword-first|k-r}[0m
|
||||
If-then-else formatting. [1mcompact [22mtries to format an if-then-else
|
||||
expression on a single line. [1mfit-or-vertical [22mvertically breaks
|
||||
branches if they do not fit on a single line. [1mvertical [22malways
|
||||
vertically breaks branches. [1mkeyword-first [22mformats if-then-else
|
||||
expressions such that the if-then-else keywords are the first on
|
||||
the line. [1mk-r [22mformats if-then-else expressions with parentheses
|
||||
that match the K&R style. The default value is [1mcompact[22m.
|
||||
|
||||
[1m--indent-after-in[22m=[4mCOLS[0m
|
||||
Indentation ([4mCOLS[24m columns) after ‘let ... in‘, unless followed by
|
||||
another ‘let‘. The default value is [1m0[22m. Cannot be set in attributes.
|
||||
|
||||
[1m--indicate-multiline-delimiters[22m=[4m{no|space|closing-on-separate-line}[0m
|
||||
How to indicate that two matching delimiters live on different
|
||||
lines. [1mno [22mdoesn't do anything special to indicate the closing
|
||||
delimiter. [1mspace [22mprints a space inside the delimiter to indicate
|
||||
the matching one is on a different line. [1mclosing-on-separate-line[0m
|
||||
makes sure that the closing delimiter is on its own line. The
|
||||
default value is [1mno[22m.
|
||||
|
||||
[1m--indicate-nested-or-patterns[22m=[4m{unsafe-no|space}[0m
|
||||
Control whether or not to indicate nested or-pattern using
|
||||
indentation. [1munsafe-no [22mdoes not indicate nested or-patterns.
|
||||
Warning: this can produce confusing code where a short body of a
|
||||
match case is visually hidden by surrounding long patterns, leading
|
||||
to misassociation between patterns and body expressions. [1mspace[0m
|
||||
starts lines of nested or-patterns with " |" rather than "| ". The
|
||||
default value is [1munsafe-no[22m.
|
||||
|
||||
[1m--infix-precedence[22m=[4m{indent|parens}[0m
|
||||
Use indentation or also discretionary parentheses to explicitly
|
||||
disambiguate precedences of infix operators. [1mindent [22muses
|
||||
indentation to explicitly disambiguate precedences of infix
|
||||
operators. [1mparens [22muses parentheses to explicitly disambiguate
|
||||
precedences of infix operators. The default value is [1mindent[22m.
|
||||
|
||||
[1m--leading-nested-match-parens[0m
|
||||
Nested match parens formatting. The flag is [1munset [22mby default.
|
||||
Cannot be set in attributes.
|
||||
|
||||
[1m--let-and[22m=[4m{compact|sparse}[0m
|
||||
Style of let_and. [1mcompact [22mwill try to format ‘let p = e and p = e‘
|
||||
in a single line. [1msparse [22mwill always break between them. The
|
||||
default value is [1mcompact[22m.
|
||||
|
||||
[1m--let-binding-deindent-fun[0m
|
||||
Deindent a line beginning with ‘fun‘. The flag is [1mset [22mby default.
|
||||
|
||||
[1m--let-binding-indent[22m=[4mCOLS[0m
|
||||
Indentation of let binding expressions ([4mCOLS[24m columns) if they do
|
||||
not fit on a single line. The default value is [1m2[22m. Cannot be set in
|
||||
attributes.
|
||||
|
||||
[1m--let-binding-spacing[22m=[4m{compact|sparse|double-semicolon}[0m
|
||||
Spacing between let binding. [1mcompact [22mspacing separates adjacent let
|
||||
bindings in a module according to module-item-spacing. [1msparse[0m
|
||||
places two open lines between a multi-line module-level let binding
|
||||
and the next. [1mdouble-semicolon [22mplaces double semicolons and an open
|
||||
line between a multi-line module-level let binding and the next.
|
||||
The default value is [1mcompact[22m.
|
||||
|
||||
[1m--let-module[22m=[4m{compact|sparse}[0m
|
||||
Module binding formatting. [1mcompact [22mdoes not break a line after the
|
||||
[4mlet[24m [4mmodule[24m [4m...[24m [4m=[24m and before the [4min[24m if the module declaration does
|
||||
not fit on a single line. [1msparse [22mbreaks a line after [4mlet[24m [4mmodule[24m [4m...[0m
|
||||
[4m=[24m and before the [4min[24m if the module declaration does not fit on a
|
||||
single line. The default value is [1mcompact[22m.
|
||||
|
||||
[1m--line-endings[22m=[4m{lf|crlf}[0m
|
||||
Line endings used. [1mlf [22muses Unix line endings. [1mcrlf [22muses Windows
|
||||
line endings. The default value is [1mlf[22m. Cannot be set in attributes.
|
||||
|
||||
[1m-m [4m[22mCOLS[24m, [1m--margin[22m=[4mCOLS[0m
|
||||
Format code to fit within [4mCOLS[24m columns. The default value is [1m80[22m.
|
||||
Cannot be set in attributes.
|
||||
|
||||
[1m--match-indent[22m=[4mCOLS[0m
|
||||
Indentation of match/try cases ([4mCOLS[24m columns). The default value is
|
||||
[1m0[22m.
|
||||
|
||||
[1m--match-indent-nested[22m=[4m{never|always|auto}[0m
|
||||
Whether the [1mmatch-indent [22mparameter should be applied even when in a
|
||||
sub-block. [1mnever [22monly applies [1mmatch-indent [22mif the match block
|
||||
starts a line. [1malways [22malways apply [1mmatch-indent[22m. [1mauto [22mapplies
|
||||
[1mmatch-indent [22mwhen seen fit. The default value is [1mnever[22m.
|
||||
|
||||
[1m--max-indent[22m=[4mCOLS[0m
|
||||
Maximum offset ([4mCOLS[24m columns) added to a new line in addition to
|
||||
the offset of the previous line. The default value is [1m68[22m. Cannot be
|
||||
set in attributes.
|
||||
|
||||
[1m--module-item-spacing[22m=[4m{compact|sparse|preserve}[0m
|
||||
Spacing between items of structures and signatures. [1mcompact [22mwill
|
||||
not leave open lines between one-liners of similar sorts. [1msparse[0m
|
||||
will always break a line between two items. [1mpreserve [22mwill not leave
|
||||
open lines between one-liners of similar sorts unless there is an
|
||||
open line in the input. The default value is [1mcompact[22m.
|
||||
|
||||
[1m--nested-match[22m=[4m{wrap|align}[0m
|
||||
Style of a pattern-matching nested in the last case of another
|
||||
pattern-matching. [1mwrap [22mwraps the nested pattern-matching with
|
||||
parentheses and adds indentation. [1malign [22mvertically aligns the
|
||||
nested pattern-matching under the encompassing pattern-matching.
|
||||
The default value is [1mwrap[22m.
|
||||
|
||||
[1m--no-break-infix-before-func[0m
|
||||
Unset [1mbreak-infix-before-func[22m.
|
||||
|
||||
[1m--no-break-sequences[0m
|
||||
Unset [1mbreak-sequences[22m.
|
||||
|
||||
[1m--no-disambiguate-non-breaking-match[0m
|
||||
Unset [1mdisambiguate-non-breaking-match[22m.
|
||||
|
||||
[1m--no-dock-collection-brackets[0m
|
||||
Unset [1mdock-collection-brackets[22m.
|
||||
|
||||
[1m--no-leading-nested-match-parens[0m
|
||||
Unset [1mleading-nested-match-parens[22m.
|
||||
|
||||
[1m--no-let-binding-deindent-fun[0m
|
||||
Unset [1mlet-binding-deindent-fun[22m.
|
||||
|
||||
[1m--no-ocp-indent-compat[0m
|
||||
Unset [1mocp-indent-compat[22m.
|
||||
|
||||
[1m--no-parens-ite[0m
|
||||
Unset [1mparens-ite[22m.
|
||||
|
||||
[1m--no-parse-docstrings[0m
|
||||
Unset [1mparse-docstrings[22m.
|
||||
|
||||
[1m--no-parse-toplevel-phrases[0m
|
||||
Unset [1mparse-toplevel-phrases[22m.
|
||||
|
||||
[1m--no-space-around-arrays[0m
|
||||
Unset [1mspace-around-arrays[22m.
|
||||
|
||||
[1m--no-space-around-lists[0m
|
||||
Unset [1mspace-around-lists[22m.
|
||||
|
||||
[1m--no-space-around-records[0m
|
||||
Unset [1mspace-around-records[22m.
|
||||
|
||||
[1m--no-space-around-variants[0m
|
||||
Unset [1mspace-around-variants[22m.
|
||||
|
||||
[1m--no-wrap-comments[0m
|
||||
Unset [1mwrap-comments[22m.
|
||||
|
||||
[1m--no-wrap-fun-args[0m
|
||||
Unset [1mwrap-fun-args[22m.
|
||||
|
||||
[1m--ocp-indent-compat[0m
|
||||
Attempt to generate output which does not change (much) when
|
||||
post-processing with ocp-indent. The flag is [1munset [22mby default.
|
||||
|
||||
[1m-p [4m[22m{default|conventional|ocamlformat|janestreet}[24m,
|
||||
[1m--profile[22m=[4m{default|conventional|ocamlformat|janestreet}[0m
|
||||
Select a preset profile which sets [4mall[24m options, overriding lower
|
||||
priority configuration. [1mdefault [22mis an alias for the [1mconventional[0m
|
||||
profile. The [1mconventional [22mprofile aims to be as familiar and
|
||||
"conventional" appearing as the available options allow. The
|
||||
[1mocamlformat [22mprofile aims to take advantage of the strengths of a
|
||||
parsetree-based auto-formatter, and to limit the consequences of
|
||||
the weaknesses imposed by the current implementation. This is a
|
||||
style which optimizes for what the formatter can do best, rather
|
||||
than to match the style of any existing code. General guidelines
|
||||
that have directed the design include: Legibility, in the sense of
|
||||
making it as hard as possible for quick visual parsing to give the
|
||||
wrong interpretation, is of highest priority; Whenever possible the
|
||||
high-level structure of the code should be obvious by looking only
|
||||
at the left margin, in particular, it should not be necessary to
|
||||
visually jump from left to right hunting for critical keywords,
|
||||
tokens, etc; All else equal compact code is preferred as reading
|
||||
without scrolling is easier, so indentation or white space is
|
||||
avoided unless it helps legibility; Attention has been given to
|
||||
making some syntactic gotchas visually obvious. The [1mjanestreet[0m
|
||||
profile is used at Jane Street. The default value is [1mdefault[22m.
|
||||
|
||||
[1m--parens-ite[0m
|
||||
Uses parentheses around if-then-else branches that spread across
|
||||
multiple lines. The flag is [1munset [22mby default.
|
||||
|
||||
[1m--parens-tuple[22m=[4m{always|multi-line-only}[0m
|
||||
Parens tuple expressions. [1malways [22malways uses parentheses around
|
||||
tuples. [1mmulti-line-only [22mmode will try to skip parens for
|
||||
single-line tuples. The default value is [1malways[22m.
|
||||
|
||||
[1m--parens-tuple-patterns[22m=[4m{multi-line-only|always}[0m
|
||||
Parens tuple patterns. [1mmulti-line-only [22mmode will try to skip parens
|
||||
for single-line tuple patterns. [1malways [22malways uses parentheses
|
||||
around tuples patterns. The default value is [1mmulti-line-only[22m.
|
||||
|
||||
[1m--parse-docstrings[0m
|
||||
Parse and format docstrings. The flag is [1mset [22mby default.
|
||||
|
||||
[1m--parse-toplevel-phrases[0m
|
||||
Parse and format toplevel phrases and their output. The flag is
|
||||
[1munset [22mby default.
|
||||
|
||||
[1m--sequence-blank-line[22m=[4m{preserve-one|compact}[0m
|
||||
Blank line between expressions of a sequence. [1mpreserve [22mwill keep a
|
||||
blank line between two expressions of a sequence if the input
|
||||
contains at least one. [1mcompact [22mwill not keep any blank line between
|
||||
expressions of a sequence. The default value is [1mpreserve-one[22m.
|
||||
|
||||
[1m--sequence-style[22m=[4m{terminator|separator|before}[0m
|
||||
Style of sequence. [1mterminator [22monly puts spaces after semicolons.
|
||||
[1mseparator [22mputs spaces before and after semicolons. [1mbefore [22mbreaks
|
||||
the sequence before semicolons. The default value is [1mterminator[22m.
|
||||
|
||||
[1m--single-case[22m=[4m{compact|sparse}[0m
|
||||
Style of pattern matching expressions with only a single case.
|
||||
[1mcompact [22mwill try to format a single case on a single line. [1msparse[0m
|
||||
will always break the line before a single case. The default value
|
||||
is [1mcompact[22m.
|
||||
|
||||
[1m--space-around-arrays[0m
|
||||
Add a space inside the delimiters of arrays. The flag is [1mset [22mby
|
||||
default.
|
||||
|
||||
[1m--space-around-lists[0m
|
||||
Add a space inside the delimiters of lists. The flag is [1mset [22mby
|
||||
default.
|
||||
|
||||
[1m--space-around-records[0m
|
||||
Add a space inside the delimiters of records. The flag is [1mset [22mby
|
||||
default.
|
||||
|
||||
[1m--space-around-variants[0m
|
||||
Add a space inside the delimiters of variants. The flag is [1mset [22mby
|
||||
default.
|
||||
|
||||
[1m--stritem-extension-indent[22m=[4mCOLS[0m
|
||||
Indentation of structure items inside extension nodes ([4mCOLS[0m
|
||||
columns). The default value is [1m0[22m.
|
||||
|
||||
[1m--type-decl[22m=[4m{compact|sparse}[0m
|
||||
Style of type declaration. [1mcompact [22mwill try to format constructors
|
||||
and records definition in a single line. [1msparse [22mwill always break
|
||||
between constructors and record fields. The default value is
|
||||
[1mcompact[22m.
|
||||
|
||||
[1m--type-decl-indent[22m=[4mCOLS[0m
|
||||
Indentation of type declarations ([4mCOLS[24m columns) if they do not fit
|
||||
on a single line. The default value is [1m2[22m. Cannot be set in
|
||||
attributes.
|
||||
|
||||
[1m--wrap-comments[0m
|
||||
Comments are divided into paragraphs by open lines (two or more
|
||||
consecutive newlines), and each paragraph is wrapped at the margin.
|
||||
Multi-line comments with vertically-aligned asterisks on the left
|
||||
margin are not wrapped. Consecutive comments with both left and
|
||||
right margin aligned are not wrapped either. The flag is [1munset [22mby
|
||||
default.
|
||||
|
||||
[1m--wrap-fun-args[0m
|
||||
Style for function call. The flag is [1mset [22mby default.
|
||||
|
||||
[1mOPTIONS (REMOVED)[0m
|
||||
[1m--align-cases[22m=[4mVAL[0m
|
||||
This option has been removed in version 0.22.
|
||||
|
||||
[1m--align-constructors-decl[22m=[4mVAL[0m
|
||||
This option has been removed in version 0.22.
|
||||
|
||||
[1m--align-variants-decl[22m=[4mVAL[0m
|
||||
This option has been removed in version 0.22.
|
||||
|
||||
[1m--doc-comments-val[22m=[4mVAL[0m
|
||||
This option has been removed in version 0.16. If you are using
|
||||
‘doc-comments-val=before‘ in combination with ‘doc-comments=before‘
|
||||
then only ‘doc-comments=before‘ is now required to achive the same
|
||||
behavior. If you are using ‘doc-comments-val=before‘ in combination
|
||||
with ‘doc-comments=after‘ this behavior is not available anymore.
|
||||
If you are using ‘doc-comments-val=after‘ in combination with
|
||||
‘doc-comments=before‘ please now use
|
||||
‘doc-comments=before-except-val‘. If you are using
|
||||
‘doc-comments-val=after‘ in combination with ‘doc-comments=after‘
|
||||
then only ‘doc-comments=after-when-possible‘ is now required to
|
||||
achieve the same behavior. If you are using
|
||||
‘doc-comments-val=unset‘ the same behavior can now be achieved by
|
||||
setting ‘doc-comments‘ only.
|
||||
|
||||
[1m--escape-chars[22m=[4mVAL[0m
|
||||
This option has been removed in version 0.16. Concrete syntax will
|
||||
now always be preserved.
|
||||
|
||||
[1m--escape-strings[22m=[4mVAL[0m
|
||||
This option has been removed in version 0.16. Concrete syntax will
|
||||
now always be preserved.
|
||||
|
||||
[1m--extension-sugar[22m=[4mVAL[0m
|
||||
This option has been removed in version 0.17. Concrete syntax will
|
||||
now always be preserved.
|
||||
|
||||
[1m--let-open[22m=[4mVAL[0m
|
||||
This option has been removed in version 0.17. Concrete syntax will
|
||||
now always be preserved.
|
||||
|
||||
[1mOPTIONS[0m
|
||||
Unless mentioned otherwise non-formatting options cannot be set in
|
||||
attributes or [1m.ocamlformat [22mfiles.
|
||||
|
||||
[1m-c [4m[22mVAL[24m, [1m--config[22m=[4mVAL[24m (absent [1mOCAMLFORMAT [22menv)
|
||||
Aggregate options. Options are specified as a comma-separated list
|
||||
of pairs: [4moption[24m[1m=[4m[22mVAL[24m[1m,[22m...[1m,[4m[22moption[24m[1m=[4m[22mVAL[24m.
|
||||
|
||||
[1m--check[0m
|
||||
Check whether the input files already are formatted. Mutually
|
||||
exclusive with --inplace and --output.
|
||||
|
||||
[1m--comment-check[0m
|
||||
Control whether to check comments and documentation comments.
|
||||
Unsafe to turn off. May be set in [1m.ocamlformat[22m. The flag is [1mset [22mby
|
||||
default.
|
||||
|
||||
[1m--disable[0m
|
||||
Disable ocamlformat. This is used in attributes to locally disable
|
||||
automatic code formatting. One can also use [1m[@@@ocamlformat[0m
|
||||
[1m"enable"] [22minstead of [1m[@@@ocamlformat "disable=false"][22m. The flag is
|
||||
[1munset [22mby default.
|
||||
|
||||
[1m--disable-conf-attrs[0m
|
||||
Disable configuration in attributes. The flag is [1munset [22mby default.
|
||||
|
||||
[1m--disable-conf-files[0m
|
||||
Disable .ocamlformat configuration files.
|
||||
|
||||
[1m--disable-outside-detected-project[0m
|
||||
If no [1m.ocamlformat [22mconfig files have been detected, disable the
|
||||
formatting. OCamlFormat is disabled outside of a detected project
|
||||
by default, to enable the opposite behavior use
|
||||
[1m--enable-outside-detected-project[22m.
|
||||
|
||||
[1m--doc[0m
|
||||
Parse input as an odoc documentation.
|
||||
|
||||
[1m--enable-outside-detected-project[0m
|
||||
Read [1m.ocamlformat [22mconfig files outside the current project when no
|
||||
project root has been detected for the input file. The project root
|
||||
of an input file is taken to be the nearest ancestor directory that
|
||||
contains a [1m.git [22mor [1m.hg [22mor [1mdune-project [22mfile. If [1m.ocamlformat [22mconfig
|
||||
files are located in the same directory or parents they are
|
||||
applied, if no [1m.ocamlformat [22mfile is found then the global
|
||||
configuration defined in [1m$XDG_CONFIG_HOME/.ocamlformat [22m(or in
|
||||
[1m$HOME/.config/.ocamlformat [22mif [1m$XDG_CONFIG_HOME [22mis undefined) is
|
||||
applied.
|
||||
|
||||
[1m-g[22m, [1m--debug[0m
|
||||
Generate debugging output. The flag is [1munset [22mby default.
|
||||
|
||||
[1m-i[22m, [1m--inplace[0m
|
||||
Format in-place, overwriting input file(s).
|
||||
|
||||
[1m--ignore-invalid-option[0m
|
||||
Ignore invalid options (e.g. in .ocamlformat).
|
||||
|
||||
[1m--impl[0m
|
||||
Parse input as an implementation.
|
||||
|
||||
[1m--intf[0m
|
||||
Parse input as an interface.
|
||||
|
||||
[1m--margin-check[0m
|
||||
Emit a warning if the formatted output exceeds the margin. The flag
|
||||
is [1munset [22mby default.
|
||||
|
||||
[1m-n [4m[22mN[24m, [1m--max-iters[22m=[4mN[0m
|
||||
Fail if output of formatting does not stabilize within [4mN[0m
|
||||
iterations. May be set in [1m.ocamlformat[22m. The default value is [1m10[22m.
|
||||
|
||||
[1m--name[22m=[4mNAME[0m
|
||||
Name of input file for use in error reporting and starting point
|
||||
when searching for '.ocamlformat' files. Defaults to the input file
|
||||
name. Some options can be specified in configuration files named
|
||||
'.ocamlformat' in the same or a parent directory of [4mNAME[24m, see
|
||||
documentation of other options for details.
|
||||
|
||||
[1m--no-comment-check[0m
|
||||
Unset [1mcomment-check[22m.
|
||||
|
||||
[1m--no-debug[0m
|
||||
Unset [1mdebug[22m.
|
||||
|
||||
[1m--no-disable[0m
|
||||
Unset [1mdisable[22m.
|
||||
|
||||
[1m--no-disable-conf-attrs[0m
|
||||
Unset [1mdisable-conf-attrs[22m.
|
||||
|
||||
[1m--no-margin-check[0m
|
||||
Unset [1mmargin-check[22m.
|
||||
|
||||
[1m--no-quiet[0m
|
||||
Unset [1mquiet[22m.
|
||||
|
||||
[1m--no-version-check[0m
|
||||
Unset [1mversion-check[22m.
|
||||
|
||||
[1m-o [4m[22mDST[24m, [1m--output[22m=[4mDST[0m
|
||||
Output file. Mutually exclusive with --inplace. Write to stdout if
|
||||
omitted.
|
||||
|
||||
[1m--ocaml-version[22m=[4mV[0m
|
||||
Version of OCaml syntax of the output. The default value is [1m4.04.0[22m.
|
||||
|
||||
[1m--ocp-indent-config[0m
|
||||
Read .ocp-indent configuration files. [1mbase [22mis an alias for
|
||||
[1mlet-binding-indent[22m. [1mtype [22mis an alias for [1mtype-decl-indent[22m. [1min [22mis an
|
||||
alias for [1mindent-after-in[22m. [1mwith [22msets [1mfunction-indent [22mand
|
||||
[1mmatch-indent[22m. [1mmatch_clause [22mis an alias for [1mcases-exp-indent[22m.
|
||||
[1mppx_stritem_ext [22mis an alias for [1mstritem-extension-indent[22m.
|
||||
[1mmax_indent [22mis an alias for [1mmax-indent[22m. [1mstrict_with [22msets
|
||||
[1mfunction-indent-nested [22mand [1mmatch-indent-nested[22m.
|
||||
|
||||
[1m--print-config[0m
|
||||
Print the configuration determined by the environment variable, the
|
||||
configuration files, preset profiles and command line. Attributes
|
||||
are not considered. If many input files are specified, only print
|
||||
the configuration for the first file. If no input file is
|
||||
specified, print the configuration for the root directory if
|
||||
specified, or for the current working directory otherwise.
|
||||
|
||||
[1m-q[22m, [1m--quiet[0m
|
||||
Quiet. May be set in [1m.ocamlformat[22m. The flag is [1munset [22mby default.
|
||||
|
||||
[1m--repl-file[0m
|
||||
Parse input as toplevel phrases with their output.
|
||||
|
||||
[1m--root[22m=[4mDIR[0m
|
||||
Root of the project. If specified, only take into account
|
||||
.ocamlformat configuration files inside [4mDIR[24m and its subdirectories.
|
||||
|
||||
[1m--use-file[0m
|
||||
Deprecated. Same as [1mimpl[22m.
|
||||
|
||||
[1m--version-check[0m
|
||||
Check that the version matches the one specified in .ocamlformat.
|
||||
The flag is [1mset [22mby default.
|
||||
|
||||
[4mSRC[24m Input files. At least one is required, and exactly one without
|
||||
[1m--inplace[22m. If [1m- [22mis passed, will read from stdin.
|
||||
|
||||
[1mCOMMON OPTIONS[0m
|
||||
[1m--help[22m[=[4mFMT[24m] (default=[1mauto[22m)
|
||||
Show this help in format [4mFMT[24m. The value [4mFMT[24m must be one of [1mauto[22m,
|
||||
[1mpager[22m, [1mgroff [22mor [1mplain[22m. With [1mauto[22m, the format is [1mpager [22mor [1mplain[0m
|
||||
whenever the [1mTERM [22menv var is [1mdumb [22mor undefined.
|
||||
|
||||
[1m--version[0m
|
||||
Show version information.
|
||||
|
||||
[1mEXIT STATUS[0m
|
||||
[1mocamlformat [22mexits with:
|
||||
|
||||
0 on success.
|
||||
|
||||
123 on indiscriminate errors reported on standard error.
|
||||
|
||||
124 on command line parsing errors.
|
||||
|
||||
125 on unexpected internal errors (bugs).
|
||||
|
||||
[1mENVIRONMENT[0m
|
||||
These environment variables affect the execution of [1mocamlformat[22m:
|
||||
|
||||
[1mOCAMLFORMAT[0m
|
||||
See option [1m--config[22m.
|
||||
|
||||
Ocamlformat 0.27.0 [4mOCAMLFORMAT[24m(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue