Skip to content

Commit

Permalink
Change log level when files are not found (#138)
Browse files Browse the repository at this point in the history
* Change log level when files are not found

* Adding new flag CI
  • Loading branch information
mmiranda authored Dec 2, 2021
1 parent f3ff1dc commit ac8133a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Flags struct {
TargetURL string `docopt:"-l"`
BaseURL string `docopt:"--base-url"`
Config string `docopt:"--config"`
Ci bool `docopt:"--ci"`
}

const (
Expand Down Expand Up @@ -70,6 +71,7 @@ Options:
[default: auto]
-c --config <path> Use the specified configuration file.
[default: $HOME/.config/mark]
--ci Runs on CI mode. It won't fail if files are not found.
-h --help Show this message.
-v --version Show version.
`
Expand Down Expand Up @@ -121,7 +123,12 @@ func main() {
log.Fatal(err)
}
if len(files) == 0 {
log.Fatal("No files matched")
msg := "No files matched"
if flags.Ci {
log.Warning(msg)
} else {
log.Fatal(msg)
}
}

// Loop through files matched by glob pattern
Expand Down

0 comments on commit ac8133a

Please sign in to comment.