Added ignore-stdin

This commit is contained in:
Cellebyte 2021-03-04 01:33:44 +01:00
parent b10927a052
commit 142f7b29a8
No known key found for this signature in database
GPG key ID: F623B507BFB7EDC9
2 changed files with 6 additions and 0 deletions

View file

@ -74,6 +74,10 @@ func realMain() int {
if len(cfg.Files) == 1 && cfg.Files[0] == "-" {
isStdin = true
}
// Ignore every data from stdin and check for files.
if cfg.IgnoreStdIn {
isStdin = false
}
var o output.Output
if o, err = output.New(cfg.OutputFormat, cfg.Summary, isStdin, cfg.Verbose); err != nil {

View file

@ -25,6 +25,7 @@ type Config struct {
Verbose bool
IgnoreMissingSchemas bool
IgnoreFilenamePatterns []string
IgnoreStdIn bool
Help bool
}
@ -68,6 +69,7 @@ func FromFlags(progName string, args []string) (Config, string, error) {
flags.StringVar(&skipKindsCSV, "skip", "", "comma-separated list of kinds to ignore")
flags.StringVar(&rejectKindsCSV, "reject", "", "comma-separated list of kinds to reject")
flags.BoolVar(&c.ExitOnError, "exit-on-error", false, "immediately stop execution when the first error is encountered")
flags.BoolVar(&c.IgnoreStdIn, "ignore-stdin", false, "ignores the stdin for the cli.")
flags.BoolVar(&c.IgnoreMissingSchemas, "ignore-missing-schemas", false, "skip files with missing schemas instead of failing")
flags.Var(&ignoreFilenamePatterns, "ignore-filename-pattern", "regular expression specifying paths to ignore (can be specified multiple times)")
flags.BoolVar(&c.Summary, "summary", false, "print a summary at the end")