OCAMLFORMAT-RPC(1)

πŸ¦‹ OCAMLFORMAT-RPC β€” bestie edition ✨

okay so first things first: this is the manual for ocamlformat-rpc, living in the Ocamlformat-rpc Manual (that's the manual name, tipping my hat to it πŸ’–). Lowkey iconic. Let's get into it.


🌸 NAME 🌸

ocamlformat-rpc β€” RPC mode for OCamlFormat, a tool to format OCaml code. she formats. that's her job. πŸ’…


✨ SYNOPSIS ✨

ocamlformat-rpc [OPTION]…

that's it. that's the whole vibe. you give her options (or not, she's flexible 🫢).


πŸ’œ DESCRIPTION πŸ’œ

So ocamlformat-rpc listens to RPC requests, which arrive on the standard input, and then she prints the response on the standard output. it's giving customer service, but for OCaml formatting. no cap, that's literally the whole program.


πŸŽ€ COMMANDS πŸŽ€

okay THIS is the part where it gets juicy. before the client and the server agree on a common version to use, the following commands are available: Halt to close the connection to the RPC; and Version v to ask the server to use version v.

If the server agrees upon the version, he will send the reply Version v and the protocol version is set to v. πŸ’« (note: to use another version later, the client has to close the connexion and start a new one. no takebacks, bestie.)

If the server cannot use version v, he might propose another version w by sending the reply Version w β€” and the client can accept that by sending the same request for version w, or propose another version. mutual negotiation, we love to see it. 🫢

If the server cannot propose another version, it will close the connection. πŸ’€

Unknown commands are ignored. (they get the silent treatment, fr fr.)

Once the client and the server agree on a common version, the requests you can send may differ from one version to another. so pay attention, okay?

All versions support the following commands:

  • Halt to end the communication with the RPC server. The caller must close the input and output channels.

Some RPC versions offer specific commands, that are detailed below.

🌈 Specific commands supported on version v1 🌈

  • Config CSEXP: submits a list of (key, value) pairs (as a canonical s-expression) to update OCamlFormat's configuration (please refer to ocamlformat --help to know more about the available options πŸ‘€). The accepted configuration is sent as a reply of the same form. The configuration can be reset to its default value by sending the pair ("profile", "default").
  • Format CSEXP: submits a canonical s-expression CSEXP to be formatted by OCamlFormat, the formatted output is sent as a reply of the same form Format CSEXP.

🧚 Specific commands supported on version v2 🧚

  • Format CSEXP: submits a list as canonical s-expression CSEXP, where the first element of the list is a string to be formatted by OCamlFormat. The other arguments are (key, value) pairs, where key can be either "Path" and/or "Config". They modify the server's configuration temporarily, for the current request. The formatted output is sent as a reply of the same form.

Unknown commands are ignored. (yeah, we said it twice. the manpage said it twice. it's a running bit now 😭)


πŸ’– 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.
  • --version β€” Show version information. bestie wants to be perceived ✨

πŸ‘‘ EXIT STATUS πŸ‘‘

ocamlformat-rpc exits with:

  • 0 β€” on success. slay. πŸŽ‰
  • 123 β€” on indiscriminate errors reported on standard error. 😭
  • 124 β€” on command line parsing errors. πŸ™ˆ
  • 125 β€” on unexpected internal errors (bugs). πŸ’€
so like, if you see 125, that's not you, that's her. it's a bug. don't blame yourself. 🫢

🌟 and that's the whole page 🌟

this was Ocamlformat-rpc 0.29.0, and yes, the manual name is OCAMLFORMAT-RPC(1) β€” we stan a lowercase-bin, uppercase-manpage queen. go format something gorgeous, bestie. πŸ’…πŸŒΈβœ¨

πŸ“¦ where this page comes from