diff options
author | Robert van Gent <rvangent@google.com> | 2020-07-04 10:15:46 -0700 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-07-04 21:19:25 +0200 |
commit | a1c3e3c1f32bcbc3b3aa6921bdee98a9f795a2da (patch) | |
tree | 1549a408dba301ea0a67ff52c2aeda3ba8c48239 | |
parent | 42e150fbfac736bd49bc7e50cb8cdf9f81386f59 (diff) |
deploy: Ensure that non-trivial default flag values are passed through.
-rw-r--r-- | commands/deploy.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/commands/deploy.go b/commands/deploy.go index ab51c9eb6..7133f9a0e 100644 --- a/commands/deploy.go +++ b/commands/deploy.go @@ -25,6 +25,9 @@ var _ cmder = (*deployCmd)(nil) // deployCmd supports deploying sites to Cloud providers. type deployCmd struct { *baseBuilderCmd + + invalidateCDN bool + maxDeletes int } // TODO: In addition to the "deploy" command, consider adding a "--deploy" @@ -51,6 +54,8 @@ documentation. RunE: func(cmd *cobra.Command, args []string) error { cfgInit := func(c *commandeer) error { + c.Set("invalidateCDN", cc.invalidateCDN) + c.Set("maxDeletes", cc.maxDeletes) return nil } comm, err := initializeConfig(true, false, &cc.hugoBuilderCommon, cc, cfgInit) @@ -69,8 +74,8 @@ documentation. cmd.Flags().Bool("confirm", false, "ask for confirmation before making changes to the target") cmd.Flags().Bool("dryRun", false, "dry run") cmd.Flags().Bool("force", false, "force upload of all files") - cmd.Flags().Bool("invalidateCDN", true, "invalidate the CDN cache listed in the deployment target") - cmd.Flags().Int("maxDeletes", 256, "maximum # of files to delete, or -1 to disable") + cmd.Flags().BoolVar(&cc.invalidateCDN, "invalidateCDN", true, "invalidate the CDN cache listed in the deployment target") + cmd.Flags().IntVar(&cc.maxDeletes, "maxDeletes", 256, "maximum # of files to delete, or -1 to disable") cc.baseBuilderCmd = b.newBuilderBasicCmd(cmd) |