Skip to content

Format your code with `bynk-fmt`

Goal: format Bynk source to the canonical style.

Bynk’s formatter is built into the compiler as bynkc fmt.

Terminal window
bynkc fmt src/counters.bynk
bynkc fmt src/*.bynk

This rewrites the named files to canonical form (tab indentation, normalised spacing). For example:

commons demo {
type Id=Int
fn add(a:Int,b:Int)->Int{a+b}
}

becomes:

commons demo {
type Id = Int
fn add(a: Int, b: Int) -> Int { a + b }
}

Pass - to read from stdin and write to stdout — handy for editor integrations:

Terminal window
cat src/counters.bynk | bynkc fmt -

--check verifies formatting without writing, exiting non-zero if any file is not already canonical:

Terminal window
bynkc fmt --check src/*.bynk