Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
add Flags to core command for commands without flags
Browse files Browse the repository at this point in the history
Signed-off-by: Jason McCallister <jason@craftcms.com>
  • Loading branch information
jasonmccallister committed Mar 30, 2020
1 parent 7ecacc7 commit a6a5e98
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions command/core.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package command

import (
"flag"

"github.com/mitchellh/cli"
"github.com/spf13/viper"
)
Expand All @@ -14,3 +16,10 @@ type CoreCommand struct {
flagName string
flagDryRun bool
}

func (c *CoreCommand) Flags() *flag.FlagSet {
s := flag.NewFlagSet("init", 128)
s.StringVar(&c.flagName, "name", "", "name of the machine")
s.BoolVar(&c.flagDryRun, "dry-run", false, "skip executing the command")
return s
}

0 comments on commit a6a5e98

Please # to comment.