mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
b48c534722
Signed-off-by: Patrick East <east.patrick@gmail.com>
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
// Copyright 2017 The OPA Authors. All rights reserved.
|
|
// Use of this source code is governed by an Apache2
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"github.com/spf13/pflag"
|
|
|
|
"github.com/open-policy-agent/opa/ast"
|
|
"github.com/open-policy-agent/opa/util"
|
|
)
|
|
|
|
func setMaxErrors(fs *pflag.FlagSet, errLimit *int) {
|
|
fs.IntVarP(errLimit, "max-errors", "m", ast.CompileErrorLimitDefault, "set the number of errors to allow before compilation fails early")
|
|
}
|
|
|
|
func setIgnore(fs *pflag.FlagSet, ignoreNames *[]string) {
|
|
fs.StringSliceVarP(ignoreNames, "ignore", "", []string{}, "set file and directory names to ignore during loading (e.g., '.*' excludes hidden files)")
|
|
}
|
|
|
|
const (
|
|
explainModeOff = "off"
|
|
explainModeFull = "full"
|
|
explainModeNotes = "notes"
|
|
explainModeFails = "fails"
|
|
)
|
|
|
|
func newExplainFlag(modes []string) *util.EnumFlag {
|
|
return util.NewEnumFlag(modes[0], modes)
|
|
}
|
|
|
|
func setExplain(fs *pflag.FlagSet, explain *util.EnumFlag) {
|
|
fs.VarP(explain, "explain", "", "enable query explanations")
|
|
}
|