Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI

Everything runs through the rafiki command:

CommandDoes
rafiki fmtFormats source files
rafiki lintReports lint findings, and fixes them with --fix
rafiki serverRuns the language server on stdio
rafiki coverageMeasures test coverage
rafiki completionsPrints a shell completion script

Every command has --help. The flags for each setting are listed under Settings.

Choosing files

rafiki fmt and rafiki lint take any mix of files and directories, and use the current directory when given none:

rafiki fmt
rafiki fmt source/ tests/Tests.mc

Directories are searched for .mc files. A file you name directly is used whatever its extension. Hidden directories and anything .gitignore excludes are skipped, see [files] to change that. Paths in an exclude setting are skipped even when named.

Pass - to read from stdin instead:

cat Clock.mc | rafiki fmt -
cat Clock.mc | rafiki lint -

The formatted code goes to stdout and findings go to stderr. --fix has no effect on stdin.

Checking without writing

rafiki fmt writes the formatted code back to each file. To only report what would change:

rafiki fmt --check
rafiki fmt --diff

--check lists the files that aren’t formatted, and --diff prints the changes.

Exit codes

CodeMeaning
0Nothing to report.
1Something was found, like an unformatted file or a lint finding.
2The command couldn’t run, for example because of a bad argument.

Keeping 1 and 2 apart lets CI tell failing checks from a broken setup.

Color

Output is colored when it goes to a terminal. --color always or --color never overrides that, and the NO_COLOR, CLICOLOR_FORCE and TERM=dumb environment variables are respected.

Shell completions

rafiki completions zsh  > "${fpath[1]}/_rafiki"
rafiki completions bash > ~/.local/share/bash-completion/completions/rafiki
rafiki completions fish > ~/.config/fish/completions/rafiki.fish

elvish and powershell are supported too.