REFMT(1)

πŸ“¦ version 3.18.0, in nixos 26.05, nixpkgs unstable

πŸ’… REFMT(1) β€” refmt: Reason's Parser & Pretty-printer ✨

Bestie, welcome to the REFMT(1) page from the Refmt Manual β€” we're talking about refmt, Reason's Parser & Pretty-printer. 🫢


🌸 NAME 🌸

refmt - Reason's Parser & Pretty-printer. That's the whole vibe. πŸ’–

⭐ SYNOPSIS ⭐

refmt [OPTION]… [FILENAMES]…

πŸ¦‹ DESCRIPTION πŸ¦‹

refmt lets you format Reason files, parse them, and convert them between OCaml syntax and Reason syntax. It's giving multitasking icon. ✨

πŸŽ€ ARGUMENTS πŸŽ€

  • FILENAMES β€” input files; if empty, assume stdin. No files? It just reads stdin, bestie. 🫢

✨ OPTIONS ✨

  • -e, --assume-explicit-arity β€” if a constructor's argument is a tuple, always interpret it as multiple arguments.
  • -h PATH, --heuristics-file=PATH β€” load path as a heuristics file to specify which constructors carry a tuple rather than multiple arguments. Mostly used in removing [@implicit_arity] introduced from OCaml conversion. For example, example.txt: contains Constructor1 Constructor2. iykyk 🧚
  • -i BOOL, --interface=BOOL (absent=false) β€” parse AST as an interface.
  • --in-place β€” reformat a file in-place. Yes, it edits the file itself. πŸ’…
  • -p FORM, --print=FORM (absent=re) β€” print AST in FORM, which is one of: (ml | re (default) | binary (for compiler input) | binary_reason (for interchange between Reason versions) | ast (print human readable AST directly) | none).
  • --parse=FORM β€” parse AST in FORM, which is one of: (ml | re | binary (for compiler input) | binary_reason (for interchange between Reason versions)).
  • -r, --recoverable β€” enable recoverable parser.
  • -w COLS, --print-width=COLS (absent=80 or REFMT_PRINT_WIDTH env) β€” wrapping width for printing the AST.

πŸ’œ COMMON OPTIONS πŸ’œ

  • --help[=FMT] (default=auto) β€” Show this help in format FMT. The value FMT must be one of auto, pager, groff or plain. With auto, the format is pager or plain whenever the TERM env var is dumb or undefined. Very demure, very mindful help behavior. ✨
  • --version β€” Show version information.

πŸ”₯ EXIT STATUS πŸ”₯

refmt exits with:

  • 0 β€” on success. πŸŽ‰
  • 123 β€” on indiscriminate errors reported on standard error.
  • 124 β€” on command line parsing errors.
  • 125 β€” on unexpected internal errors (bugs). Bugs? Not the vibe. 😭

🌈 ENVIRONMENT 🌈

These environment variables affect the execution of refmt:

  • REFMT_PRINT_WIDTH β€” wrapping width for printing the AST.

πŸ“ EXAMPLES πŸ“

  1. Initialise a new project named foo:
dune init project foo
  1. Format a Reason implementation file:
refmt file.re
  1. Format a Reason interface file:
refmt file.rei
  1. Format interface code from the command line:
echo 'let x: int' | refmt --interface=true
  1. Convert an OCaml file to Reason:
refmt file.ml
  1. Convert a Reason file to OCaml:
refmt file.re --print ml
  1. Convert OCaml from the command line to Reason:
echo 'let x = 1' | refmt --parse ml

That's the whole REFMT(1) moment, bestie. Source/version: Refmt Reason 3.18.0, date marker: @, page id: REFMT(1). Byeee 🫢✨

πŸ“¦ where this page comes from