Documentation
¶
Overview ¶
Package config holds the CLI configuration.
Index ¶
Constants ¶
const ( // ColorAuto enables colorized diagnostic output on a tty only. ColorAuto = "auto" // ColorAlways colorized diagnostic output without checking for a terminal. ColorAlways = "always" // ColorNever disables colorized diagnostic output. ColorNever = "never" )
What -color can be told. "auto" is the only one that looks at where it is writing.
const ( FailNever = "never" FailError = "error" FailWarning = "warning" )
What -fail-on can be told: the least serious diagnostic that still makes the command exit non-zero.
"never" is the default because a scan that emits warnings is the ordinary case - a codebase with nothing to say about it is the exception - and a command that failed the build over one would mostly teach people to stop reading it.
const ( FormatAuto = "auto" FormatJSON = "json" FormatYAML = "yaml" )
What -format can be told.
"auto" reads the extension of -output, or defaults to JSON, which is what a document going to standard output does.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the whole command line: the library's own knobs, plus this command's.
func (*Config) PrepareScan ¶
func (c *Config) PrepareScan() (options *scanner.Options, reporter *diagnostics.Reporter, err error)
PrepareScan converts a CLI Config into proper scanner.Options that the scanner understands.
It also prepares a configured diagnostics.Reporter for further reporting about diagnostics. At this point, no downstream consumer needs to know where a value came from (file, env, flag...).