1Open Policy Agent(1) Open Policy Agent(1)
2
3
4
6 opa-fmt - Format Rego source files
7
8
9
11 opa fmt [path [...]] [flags]
12
13
14
16 Format Rego source files.
17
18
19 The 'fmt' command takes a Rego source file and outputs a reformatted
20 version. If no file path is provided - this tool will use stdin. The
21 format of the output is not defined specifically; whatever this tool
22 outputs is considered correct format (with the exception of bugs).
23
24
25 If the '-w' option is supplied, the 'fmt' command with overwrite the
26 source file instead of printing to stdout.
27
28
29 If the '-d' option is supplied, the 'fmt' command will output a diff
30 between the original and formatted source.
31
32
33 If the '-l' option is supplied, the 'fmt' command will output the names
34 of files that would change if formatted. The '-l' option will suppress
35 any other output to stdout from the 'fmt' command.
36
37
38 If the '--fail' option is supplied, the 'fmt' command will return a non
39 zero exit code if a file would be reformatted.
40
41
42
44 -d, --diff[=false] only display a diff of the changes
45
46
47 --fail[=false] non zero exit code on reformat
48
49
50 -h, --help[=false] help for fmt
51
52
53 -l, --list[=false] list all files who would change when formatted
54
55
56 -w, --write[=false] overwrite the original source file
57
58
59
61 opa(1)
62
63
64
65 Jan 2023 Open Policy Agent(1)