EnglishFrenchSpanish

OnWorks favicon

ocp-indent - Online in the Cloud

Run ocp-indent in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command ocp-indent that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


ocp-indent - Automatic indentation of OCaml source files

SYNOPSIS


ocp-indent [OPTION]... [FILE]...

DESCRIPTION


Indent OCaml source files according to the official conventions, with a small number of
tunable parameters.

Outputs the indented version of each FILE given in the command line to standard output,
unless invoked with the `--inplace' option (see OPTIONS below). If no FILE is provided,
reads from standard input.

OPTIONS


-c CONFIG, --config=CONFIG
Configure the indentation parameters. See section CONFIGURATION for more information.

-d, --debug
Enable debug output to stderr.

--help[=FMT] (default=pager)
Show this help in format FMT (pager, plain or groff).

-i, --inplace
Re-indent files in-place.

--indent-empty
Return indent for empty lines, too. Especially useful with $(--numeric).

-l RANGE, --lines=RANGE (absent=-)
Only re-indent the lines in RANGE (eg. 10-12), adapting to the current indentation of
surrounding lines. Lines start at 1.

--load-mods=VAL
Load plugins.

--load-pkgs=VAL
Load plugins.

--numeric
Instead of re-indenting the file, output one integer per line representing the
indentation value. When specified together with --lines, only print as many values as
lines in the range.

-o FILE, --output=FILE
Output to FILE. The default is to print to stdout.

--print-config
Print the current parameters to stdout and exit. (See section CONFIGURATION for more
information.)

--syntax=VAL
Extend the handled syntax for OCaml syntax extensions.

--version
Show version information.

CONFIGURATION


Parameters can be defined on the command-line via the --config option, or as a
configuration definition in one of the following, searched in order: a file named
`.ocp-indent' in the current directory or its parents (which allows for per-project
indentation settings), the file `$(HOME)/.ocp/ocp-indent.conf', or the environment
variable $(OCP_INDENT_CONFIG).

A configuration definition is a list of bindings in the form NAME=VALUE or of PRESET,
separated by commas or newlines

Syntax: [PRESET,]VAR=VALUE[,VAR=VALUE...]

base=INT (default=2)
Indentation used when none of the following options applies.

        let foo =
        ..bar

type=INT (default=2)
Indentation for type definitions.

        type t =
        ..int

in=INT (default=0)
Indentation after `let ... in', unless followed by another `let'.

        let foo = () in
        ..bar

with=INT (default=0)
Indentation after `match ... with', `try ... with' or `function'.

        match foo with
        ..| _ -> bar

match_clause=INT (default=2)
Indentation for clauses inside a pattern-match (after arrows).

        match foo with
        | _ ->
        ..bar

ppx_stritem_ext=INT (default=2)
Indentation for items inside a [%%id ... ] extension node).

        [%% id.id
        ..let x = 3 ]

max_indent=<INT|none> (default=4)
When nesting expressions on the same line, their indentations are stacked in some
cases so that they remain correct if you close them one per line. However, this can
lead to large indentations in complex code, so this parameter sets a maximum
indentation. Note that it only affects indentation after function arrows and opening
parens at the ends of lines.

        let f = g (h (i (fun x ->
        ....x)
          )
        )

strict_with=<always|never|auto> (default=never)
If `never', match bars are indented, superseding `with', whenever `match with' doesn't
start its line. If `auto', there are exceptions for constructs like `begin match
with'. If `always', `with' is always strictly respected.

    Example with `strict_with=never,with=0':
        begin match foo with
        ..| _ -> bar
        end

strict_else=<always|never|auto> (default=always)
If `always', indent after the `else' keyword normally, like after `then'. If `auto',
indent after `else' unless in a few "unclosable" cases (`let .... in', `match', etc.).
If `never', the `else' keyword won't indent when followed by a newline.

    Example with `strict_else=auto':
        if cond then
          foo
        else
        let x = bar in
        baz

strict_comments=BOOL (default=false)
In-comment indentation is normally preserved, as long as it respects the left margin
or the comments starts with a newline. Setting this to `true' forces alignment within
comments. Lines starting with `*' are always aligned

align_ops=BOOL (default=true)
Toggles preference of column-alignment over line indentation for most of the common
operators and after mid-line opening parentheses.

    Example with `align_ops=true':
        let f x = x
                  + y
 
    Example with `align_ops=false':
        let f x = x
          + y

align_params=<always|never|auto> (default=auto)
If `never', function parameters are indented one level from the line of the function.
If `always', they are aligned from the column of the function. if `auto', alignment is
chosen over indentation in a few cases, e.g. after match arrows

    Example with `align_params=never':
        match foo with
        | _ -> some_fun
          ..parameter
 
    Example with `align_params=always' or `auto':
        match foo with
        | _ -> some_fun
               ..parameter

Available presets are `normal', the default, `apprentice' which may make some aspects of
the syntax more obvious for beginners, and `JaneStreet'.

Use ocp-indent online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    OfficeFloor
    OfficeFloor
    OfficeFloor provides inversion of
    coupling control, with its: - dependency
    injection - continuation injection -
    thread injection For more information
    visit the...
    Download OfficeFloor
  • 2
    DivKit
    DivKit
    DivKit is an open source Server-Driven
    UI (SDUI) framework. It allows you to
    roll out server-sourced updates to
    different app versions. Also, it can be
    used fo...
    Download DivKit
  • 3
    subconverter
    subconverter
    Utility to convert between various
    subscription format. Shadowrocket users
    should use ss, ssr or v2ray as target.
    You can add &remark= to
    Telegram-liked HT...
    Download subconverter
  • 4
    SWASH
    SWASH
    SWASH is a general-purpose numerical
    tool for simulating unsteady,
    non-hydrostatic, free-surface,
    rotational flow and transport phenomena
    in coastal waters as ...
    Download SWASH
  • 5
    VBA-M (Archived - Now on Github)
    VBA-M (Archived - Now on Github)
    Project has moved to
    https://github.com/visualboyadvance-m/visualboyadvance-m
    Features:Cheat creationsave statesmulti
    system, supports gba, gbc, gb, sgb,
    sgb2Tu...
    Download VBA-M (Archived - Now on Github)
  • 6
    Stacer
    Stacer
    Linux System Optimizer and Monitoring
    Github Repository:
    https://github.com/oguzhaninan/Stacer.
    Audience: End Users/Desktop. User
    interface: Qt. Programming La...
    Download Stacer
  • More »

Linux commands

  • 1
    7za
    7za
    7za - A file archiver with highest
    compression ratio ...
    Run 7za
  • 2
    7zr
    7zr
    7zr - A file archiver with highest
    compression ratio ...
    Run 7zr
  • 3
    cpan
    cpan
    cpan - easily interact with CPAN from
    the command line ...
    Run cpan
  • 4
    cpan2debp
    cpan2debp
    dh-make-perl - Create debian source
    packages from Perl modules ...
    Run cpan2debp
  • 5
    fweelin
    fweelin
    freewheeling � live looping musical
    instrument ...
    Run fweelin
  • 6
    fwexec
    fwexec
    fwexec - program to upload and rexecute
    image file to a connected NXT device ...
    Run fwexec
  • More »

Ad