Skip to content

Commit

Permalink
Updating opa fmt --help text
Browse files Browse the repository at this point in the history
Signed-off-by: Johan Fylling <[email protected]>
  • Loading branch information
johanfylling committed Dec 18, 2024
1 parent a048ff8 commit 24fdd47
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions cmd/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ 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
If the '-w' option is supplied, the 'fmt' command will overwrite the source file
instead of printing to stdout.
If the '-d' option is supplied, the 'fmt' command will output a diff between the
Expand All @@ -70,7 +70,26 @@ 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.`,
code if a file would be reformatted.
The 'fmt' command can be run in several compatibility modes for consuming and outputting
different Rego versions:
* 'opa fmt':
* v1 Rego is formatted to v1
* 'rego.v1'/'future.keywords' imports are NOT removed
* 'rego.v1'/'future.keywords' imports are NOT added if missing
* v0 rego is rejected
* 'opa fmt --v0-compatible':
* v0 Rego is formatted to v0
* v1 Rego is rejected
* 'opa fmt --v0-v1':
* v0 Rego is formatted to be compatible with v0 AND v1
* v1 Rego is rejected
* 'opa fmt --v0-v1 --v1-compatible':
* v1 Rego is formatted to be compatible with v0 AND v1
* v0 Rego is rejected
`,
PreRunE: func(cmd *cobra.Command, _ []string) error {
return env.CmdFlags.CheckEnvironmentVariables(cmd)
},
Expand Down

0 comments on commit 24fdd47

Please sign in to comment.