opa-fmt - Man Page

Format Rego source files

Synopsis

opa fmt [path [...]] [flags]

Description

Format Rego source files.

The 'fmt' command takes a Rego source file and outputs a reformatted version. If no file path is provided - this tool will use stdin. The format of the output is not defined specifically; whatever this tool outputs is considered correct format (with the exception of bugs).

If the '-w' option is supplied, the 'fmt' command with overwrite the source file instead of printing to stdout.

If the '-d' option is supplied, the 'fmt' command will output a diff between the original and formatted source.

If the '-l' option is supplied, the 'fmt' command will output the names of files that would change if formatted. The '-l' option will suppress any other output to stdout from the 'fmt' command.

If the '--fail' option is supplied, the 'fmt' command will return a non zero exit code if a file would be reformatted.

Options

-d, --diff[=false] only display a diff of the changes

--fail[=false] non zero exit code on reformat

-h, --help[=false] help for fmt

-l, --list[=false] list all files who would change when formatted

-w, --write[=false] overwrite the original source file

See Also

opa(1)

Referenced By

opa(1).

Jan 2023