diff --git a/internal/cli/option.go b/internal/cli/option.go index 9a0586b77..006c4346a 100644 --- a/internal/cli/option.go +++ b/internal/cli/option.go @@ -1,7 +1,7 @@ package cli import ( - "github.com/DavidGamba/go-getoptions" + "github.com/hashicorp/vagrant-plugin-sdk/component" "github.com/hashicorp/vagrant-plugin-sdk/terminal" ) @@ -18,7 +18,7 @@ func WithArgs(args []string) Option { // WithFlags sets the flags that are supported by this command. This MUST // be set otherwise a panic will happen. This is usually set by just calling // the Flags function on your command implementation. -func WithFlags(f *getoptions.GetOpt) Option { +func WithFlags(f []*component.CommandFlag) Option { return func(c *baseConfig) { c.Flags = f } } @@ -68,7 +68,7 @@ func WithUI(ui terminal.UI) Option { type baseConfig struct { Args []string - Flags *getoptions.GetOpt + Flags component.CommandFlags Config bool ConfigOptional bool Client bool diff --git a/internal/cli/ui.go b/internal/cli/ui.go index 046229bf4..bee6447f0 100644 --- a/internal/cli/ui.go +++ b/internal/cli/ui.go @@ -5,11 +5,12 @@ import ( "strings" "time" - "github.com/DavidGamba/go-getoptions" + "github.com/skratchdot/open-golang/open" + + "github.com/hashicorp/vagrant-plugin-sdk/component" "github.com/hashicorp/vagrant-plugin-sdk/terminal" "github.com/hashicorp/vagrant/internal/clierrors" "github.com/hashicorp/vagrant/internal/server/proto/vagrant_server" - "github.com/skratchdot/open-golang/open" ) type UICommand struct { @@ -86,14 +87,14 @@ func (c *UICommand) Run(args []string) int { return 0 } -func (c *UICommand) Flags() *getoptions.GetOpt { - return c.flagSet(0, func(set *getoptions.GetOpt) { - - set.BoolVar( - &c.flagAuthenticate, - "authenticate", - false, - set.Description("Creates a new invite token and passes it to the UI for authorization"), +func (c *UICommand) Flags() component.CommandFlags { + return c.flagSet(0, func(set []*component.CommandFlag) []*component.CommandFlag { + return append(set, + &component.CommandFlag{ + LongName: "authenticate", + Description: "Creates a new invite token and passes it to the UI for authorization", + DefaultValue: "false", + }, ) }) } @@ -117,5 +118,5 @@ Usage: vagrant ui [options] Opens the new UI. When provided a flag, will automatically open the token invite page with an invite token for authentication. -` + c.Flags().Help()) +` + c.Flags().Display()) } diff --git a/internal/cli/version.go b/internal/cli/version.go index 5d89400b0..0d41a3057 100644 --- a/internal/cli/version.go +++ b/internal/cli/version.go @@ -1,8 +1,7 @@ package cli import ( - "github.com/DavidGamba/go-getoptions" - + "github.com/hashicorp/vagrant-plugin-sdk/component" "github.com/hashicorp/vagrant/internal/version" ) @@ -31,7 +30,7 @@ func (c *VersionCommand) Run(args []string) int { return 0 } -func (c *VersionCommand) Flags() *getoptions.GetOpt { +func (c *VersionCommand) Flags() component.CommandFlags { return c.flagSet(0, nil) }