From bd923207efb24a77a178f891023649479fb12410 Mon Sep 17 00:00:00 2001 From: Lukasz Mierzwa Date: Mon, 29 Nov 2021 16:24:34 +0000 Subject: [PATCH] Add --offline flag to pint ci command --- CHANGELOG.md | 6 ++++++ cmd/pint/ci.go | 1 + cmd/pint/lint.go | 1 - cmd/pint/main.go | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa136611..267f48a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [next] + +### Added + +- `--offline` flag for `pint ci` command. + ## v0.3.0 ### Added diff --git a/cmd/pint/ci.go b/cmd/pint/ci.go index 8810abc9..f82d6d17 100644 --- a/cmd/pint/ci.go +++ b/cmd/pint/ci.go @@ -28,6 +28,7 @@ func actionCI(c *cli.Context) (err error) { if err != nil { return fmt.Errorf("failed to load config file %q: %w", c.Path(configFlag), err) } + cfg.SetDisabledChecks(c.Bool(offlineFlag), nil) includeRe := []*regexp.Regexp{} for _, pattern := range cfg.CI.Include { diff --git a/cmd/pint/lint.go b/cmd/pint/lint.go index b5ab592d..f26de8c0 100644 --- a/cmd/pint/lint.go +++ b/cmd/pint/lint.go @@ -28,7 +28,6 @@ func actionLint(c *cli.Context) (err error) { if err != nil { return fmt.Errorf("failed to load config file %q: %w", c.Path(configFlag), err) } - cfg.SetDisabledChecks(c.Bool(offlineFlag), c.StringSlice(disabledFlag)) d := discovery.NewGlobFileFinder() diff --git a/cmd/pint/main.go b/cmd/pint/main.go index be86e513..7f160036 100644 --- a/cmd/pint/main.go +++ b/cmd/pint/main.go @@ -69,6 +69,14 @@ func newApp() *cli.App { Name: "ci", Usage: "Lint CI changes", Action: actionCI, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: offlineFlag, + Aliases: []string{"o"}, + Value: false, + Usage: "Disable all check that send live queries to Prometheus servers", + }, + }, }, { Name: "config",