2018-07-27 03:11:58 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
2018-07-31 16:01:54 +00:00
|
|
|
"strings"
|
2018-07-27 03:11:58 +00:00
|
|
|
|
|
|
|
hclog "github.com/hashicorp/go-hclog"
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Meta struct {
|
|
|
|
Ui cli.Ui
|
|
|
|
logger hclog.Logger
|
|
|
|
|
|
|
|
verbose bool
|
|
|
|
}
|
|
|
|
|
2018-07-31 15:41:20 +00:00
|
|
|
func NewMeta(ui cli.Ui, logger hclog.Logger) Meta {
|
|
|
|
return Meta{
|
|
|
|
Ui: ui,
|
|
|
|
logger: logger,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-27 03:11:58 +00:00
|
|
|
func (m *Meta) FlagSet(n string) *flag.FlagSet {
|
|
|
|
f := flag.NewFlagSet(n, flag.ContinueOnError)
|
|
|
|
|
2018-07-31 19:21:47 +00:00
|
|
|
f.BoolVar(&m.verbose, "verbose", false, "Toggle verbose output")
|
2018-07-27 03:11:58 +00:00
|
|
|
return f
|
|
|
|
}
|
2018-07-31 16:01:54 +00:00
|
|
|
|
|
|
|
// generalOptionsUsage return the help string for the global options
|
|
|
|
func generalOptionsUsage() string {
|
|
|
|
helpText := `
|
|
|
|
-verbose
|
|
|
|
Enables verbose logging.
|
|
|
|
`
|
|
|
|
return strings.TrimSpace(helpText)
|
|
|
|
}
|