github.com/smithx10/nomad@v0.9.1-rc1/e2e/cli/command/meta.go (about) 1 package command 2 3 import ( 4 "flag" 5 "strings" 6 7 hclog "github.com/hashicorp/go-hclog" 8 "github.com/mitchellh/cli" 9 ) 10 11 type Meta struct { 12 Ui cli.Ui 13 logger hclog.Logger 14 15 verbose bool 16 } 17 18 func NewMeta(ui cli.Ui, logger hclog.Logger) Meta { 19 return Meta{ 20 Ui: ui, 21 logger: logger, 22 } 23 } 24 25 func (m *Meta) FlagSet(n string) *flag.FlagSet { 26 f := flag.NewFlagSet(n, flag.ContinueOnError) 27 28 f.BoolVar(&m.verbose, "verbose", false, "Toggle verbose output") 29 return f 30 } 31 32 // generalOptionsUsage return the help string for the global options 33 func generalOptionsUsage() string { 34 helpText := ` 35 -verbose 36 Enables verbose logging. 37 ` 38 return strings.TrimSpace(helpText) 39 }