Files
releases/cmd/flags.go
T
Patrick East b48c534722 Run make fmt with new goimports cmd
Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-27 09:55:11 -04:00

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")
}