command: Simplify Meta.process helper method

After some refactoring, this helper method had an unused argument (vars)
and an always-nil error return value. This commit cleans this up.
This commit is contained in:
Alisdair McDiarmid 2020-04-01 15:01:08 -04:00
parent d425f62009
commit 67203dade8
36 changed files with 44 additions and 187 deletions

View File

@ -20,11 +20,7 @@ type ZeroThirteenUpgradeCommand struct {
} }
func (c *ZeroThirteenUpgradeCommand) Run(args []string) int { func (c *ZeroThirteenUpgradeCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
flags := c.Meta.defaultFlagSet("0.13upgrade") flags := c.Meta.defaultFlagSet("0.13upgrade")
flags.Usage = func() { c.Ui.Error(c.Help()) } flags.Usage = func() { c.Ui.Error(c.Help()) }
if err := flags.Parse(args); err != nil { if err := flags.Parse(args); err != nil {
@ -51,6 +47,7 @@ func (c *ZeroThirteenUpgradeCommand) Run(args []string) int {
} }
// Check for user-supplied plugin path // Check for user-supplied plugin path
var err error
if c.pluginPath, err = c.loadPluginPath(); err != nil { if c.pluginPath, err = c.loadPluginPath(); err != nil {
c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err)) c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err))
return 1 return 1

View File

@ -28,11 +28,7 @@ type ApplyCommand struct {
func (c *ApplyCommand) Run(args []string) int { func (c *ApplyCommand) Run(args []string) int {
var destroyForce, refresh, autoApprove bool var destroyForce, refresh, autoApprove bool
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdName := "apply" cmdName := "apply"
if c.Destroy { if c.Destroy {
cmdName = "destroy" cmdName = "destroy"

View File

@ -21,11 +21,7 @@ type ConsoleCommand struct {
} }
func (c *ConsoleCommand) Run(args []string) int { func (c *ConsoleCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.extendedFlagSet("console") cmdFlags := c.Meta.extendedFlagSet("console")
cmdFlags.StringVar(&c.Meta.statePath, "state", DefaultStateFilename, "path") cmdFlags.StringVar(&c.Meta.statePath, "state", DefaultStateFilename, "path")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }

View File

@ -41,11 +41,7 @@ func (c *FmtCommand) Run(args []string) int {
c.input = os.Stdin c.input = os.Stdin
} }
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.defaultFlagSet("fmt") cmdFlags := c.Meta.defaultFlagSet("fmt")
cmdFlags.BoolVar(&c.list, "list", true, "list") cmdFlags.BoolVar(&c.list, "list", true, "list")
cmdFlags.BoolVar(&c.write, "write", true, "write") cmdFlags.BoolVar(&c.write, "write", true, "write")

View File

@ -16,11 +16,7 @@ type GetCommand struct {
func (c *GetCommand) Run(args []string) int { func (c *GetCommand) Run(args []string) int {
var update bool var update bool
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.defaultFlagSet("get") cmdFlags := c.Meta.defaultFlagSet("get")
cmdFlags.BoolVar(&update, "update", false, "update") cmdFlags.BoolVar(&update, "update", false, "update")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }

View File

@ -24,11 +24,7 @@ func (c *GraphCommand) Run(args []string) int {
var moduleDepth int var moduleDepth int
var verbose bool var verbose bool
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.defaultFlagSet("graph") cmdFlags := c.Meta.defaultFlagSet("graph")
cmdFlags.BoolVar(&drawCycles, "draw-cycles", false, "draw-cycles") cmdFlags.BoolVar(&drawCycles, "draw-cycles", false, "draw-cycles")
cmdFlags.StringVar(&graphTypeStr, "type", "", "type") cmdFlags.StringVar(&graphTypeStr, "type", "", "type")

View File

@ -32,10 +32,7 @@ func (c *ImportCommand) Run(args []string) int {
} }
var configPath string var configPath string
args, err = c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.extendedFlagSet("import") cmdFlags := c.Meta.extendedFlagSet("import")
cmdFlags.IntVar(&c.Meta.parallelism, "parallelism", DefaultParallelism, "parallelism") cmdFlags.IntVar(&c.Meta.parallelism, "parallelism", DefaultParallelism, "parallelism")

View File

@ -49,11 +49,7 @@ func (c *InitCommand) Run(args []string) int {
var flagVerifyPlugins bool var flagVerifyPlugins bool
flagConfigExtra := newRawFlags("-backend-config") flagConfigExtra := newRawFlags("-backend-config")
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.extendedFlagSet("init") cmdFlags := c.Meta.extendedFlagSet("init")
cmdFlags.BoolVar(&flagBackend, "backend", true, "") cmdFlags.BoolVar(&flagBackend, "backend", true, "")
cmdFlags.Var(flagConfigExtra, "backend-config", "") cmdFlags.Var(flagConfigExtra, "backend-config", "")

View File

@ -35,11 +35,7 @@ type LoginCommand struct {
// Run implements cli.Command. // Run implements cli.Command.
func (c *LoginCommand) Run(args []string) int { func (c *LoginCommand) Run(args []string) int {
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.extendedFlagSet("login") cmdFlags := c.Meta.extendedFlagSet("login")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil { if err := cmdFlags.Parse(args); err != nil {

View File

@ -18,11 +18,7 @@ type LogoutCommand struct {
// Run implements cli.Command. // Run implements cli.Command.
func (c *LogoutCommand) Run(args []string) int { func (c *LogoutCommand) Run(args []string) int {
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.defaultFlagSet("logout") cmdFlags := c.Meta.defaultFlagSet("logout")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil { if err := cmdFlags.Parse(args); err != nil {

View File

@ -410,11 +410,7 @@ func (m *Meta) extendedFlagSet(n string) *flag.FlagSet {
// process will process the meta-parameters out of the arguments. This // process will process the meta-parameters out of the arguments. This
// will potentially modify the args in-place. It will return the resulting // will potentially modify the args in-place. It will return the resulting
// slice. // slice.
// func (m *Meta) process(args []string) []string {
// vars is now ignored. It used to control whether to process variables, but
// that is no longer the responsibility of this function. (That happens
// instead in Meta.collectVariableValues.)
func (m *Meta) process(args []string, vars bool) ([]string, error) {
// We do this so that we retain the ability to technically call // We do this so that we retain the ability to technically call
// process multiple times, even if we have no plans to do so // process multiple times, even if we have no plans to do so
if m.oldUi != nil { if m.oldUi != nil {
@ -443,7 +439,7 @@ func (m *Meta) process(args []string, vars bool) ([]string, error) {
}, },
} }
return args, nil return args
} }
// uiHook returns the UiHook to use with the context. // uiHook returns the UiHook to use with the context.

View File

@ -1888,7 +1888,7 @@ func TestBackendFromState(t *testing.T) {
func testMetaBackend(t *testing.T, args []string) *Meta { func testMetaBackend(t *testing.T, args []string) *Meta {
var m Meta var m Meta
m.Ui = new(cli.MockUi) m.Ui = new(cli.MockUi)
m.process(args, true) m.process(args)
f := m.extendedFlagSet("test") f := m.extendedFlagSet("test")
if err := f.Parse(args); err != nil { if err := f.Parse(args); err != nil {
t.Fatalf("unexpected error: %s", err) t.Fatalf("unexpected error: %s", err)

View File

@ -23,10 +23,7 @@ func TestMetaColorize(t *testing.T) {
m.Color = true m.Color = true
args = []string{"foo", "bar"} args = []string{"foo", "bar"}
args2 = []string{"foo", "bar"} args2 = []string{"foo", "bar"}
args, err := m.process(args, false) args = m.process(args)
if err != nil {
t.Fatalf("err: %s", err)
}
if !reflect.DeepEqual(args, args2) { if !reflect.DeepEqual(args, args2) {
t.Fatalf("bad: %#v", args) t.Fatalf("bad: %#v", args)
} }
@ -38,10 +35,7 @@ func TestMetaColorize(t *testing.T) {
m = new(Meta) m = new(Meta)
args = []string{"foo", "bar"} args = []string{"foo", "bar"}
args2 = []string{"foo", "bar"} args2 = []string{"foo", "bar"}
args, err = m.process(args, false) args = m.process(args)
if err != nil {
t.Fatalf("err: %s", err)
}
if !reflect.DeepEqual(args, args2) { if !reflect.DeepEqual(args, args2) {
t.Fatalf("bad: %#v", args) t.Fatalf("bad: %#v", args)
} }
@ -54,10 +48,7 @@ func TestMetaColorize(t *testing.T) {
m.Color = true m.Color = true
args = []string{"foo", "-no-color", "bar"} args = []string{"foo", "-no-color", "bar"}
args2 = []string{"foo", "bar"} args2 = []string{"foo", "bar"}
args, err = m.process(args, false) args = m.process(args)
if err != nil {
t.Fatalf("err: %s", err)
}
if !reflect.DeepEqual(args, args2) { if !reflect.DeepEqual(args, args2) {
t.Fatalf("bad: %#v", args) t.Fatalf("bad: %#v", args)
} }
@ -292,10 +283,7 @@ func TestMeta_process(t *testing.T) {
m := new(Meta) m := new(Meta)
m.Color = true // this is the default also for normal use, overridden by -no-color m.Color = true // this is the default also for normal use, overridden by -no-color
args := test.GivenArgs args := test.GivenArgs
args, err = m.process(args, true) args = m.process(args)
if err != nil {
t.Fatalf("err: %s", err)
}
if !cmp.Equal(test.FilteredArgs, args) { if !cmp.Equal(test.FilteredArgs, args) {
t.Errorf("wrong filtered arguments\n%s", cmp.Diff(test.FilteredArgs, args)) t.Errorf("wrong filtered arguments\n%s", cmp.Diff(test.FilteredArgs, args))

View File

@ -23,11 +23,7 @@ type OutputCommand struct {
} }
func (c *OutputCommand) Run(args []string) int { func (c *OutputCommand) Run(args []string) int {
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
var module, statePath string var module, statePath string
var jsonOutput bool var jsonOutput bool
cmdFlags := c.Meta.defaultFlagSet("output") cmdFlags := c.Meta.defaultFlagSet("output")

View File

@ -20,11 +20,7 @@ func (c *PlanCommand) Run(args []string) int {
var destroy, refresh, detailed bool var destroy, refresh, detailed bool
var outPath string var outPath string
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.extendedFlagSet("plan") cmdFlags := c.Meta.extendedFlagSet("plan")
cmdFlags.BoolVar(&destroy, "destroy", false, "destroy") cmdFlags.BoolVar(&destroy, "destroy", false, "destroy")
cmdFlags.BoolVar(&refresh, "refresh", true, "refresh") cmdFlags.BoolVar(&refresh, "refresh", true, "refresh")

View File

@ -27,11 +27,7 @@ func (c *ProvidersCommand) Synopsis() string {
} }
func (c *ProvidersCommand) Run(args []string) int { func (c *ProvidersCommand) Run(args []string) int {
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.defaultFlagSet("providers") cmdFlags := c.Meta.defaultFlagSet("providers")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil { if err := cmdFlags.Parse(args); err != nil {

View File

@ -24,11 +24,7 @@ func (c *ProvidersSchemaCommand) Synopsis() string {
} }
func (c *ProvidersSchemaCommand) Run(args []string) int { func (c *ProvidersSchemaCommand) Run(args []string) int {
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.defaultFlagSet("providers schema") cmdFlags := c.Meta.defaultFlagSet("providers schema")
var jsonOutput bool var jsonOutput bool
cmdFlags.BoolVar(&jsonOutput, "json", false, "produce JSON output") cmdFlags.BoolVar(&jsonOutput, "json", false, "produce JSON output")
@ -47,6 +43,7 @@ func (c *ProvidersSchemaCommand) Run(args []string) int {
} }
// Check for user-supplied plugin path // Check for user-supplied plugin path
var err error
if c.pluginPath, err = c.loadPluginPath(); err != nil { if c.pluginPath, err = c.loadPluginPath(); err != nil {
c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err)) c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err))
return 1 return 1

View File

@ -16,11 +16,7 @@ type RefreshCommand struct {
} }
func (c *RefreshCommand) Run(args []string) int { func (c *RefreshCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.extendedFlagSet("refresh") cmdFlags := c.Meta.extendedFlagSet("refresh")
cmdFlags.StringVar(&c.Meta.statePath, "state", DefaultStateFilename, "path") cmdFlags.StringVar(&c.Meta.statePath, "state", DefaultStateFilename, "path")
cmdFlags.IntVar(&c.Meta.parallelism, "parallelism", DefaultParallelism, "parallelism") cmdFlags.IntVar(&c.Meta.parallelism, "parallelism", DefaultParallelism, "parallelism")

View File

@ -24,11 +24,7 @@ type ShowCommand struct {
} }
func (c *ShowCommand) Run(args []string) int { func (c *ShowCommand) Run(args []string) int {
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.defaultFlagSet("show") cmdFlags := c.Meta.defaultFlagSet("show")
var jsonOutput bool var jsonOutput bool
cmdFlags.BoolVar(&jsonOutput, "json", false, "produce JSON output") cmdFlags.BoolVar(&jsonOutput, "json", false, "produce JSON output")
@ -48,6 +44,7 @@ func (c *ShowCommand) Run(args []string) int {
} }
// Check for user-supplied plugin path // Check for user-supplied plugin path
var err error
if c.pluginPath, err = c.loadPluginPath(); err != nil { if c.pluginPath, err = c.loadPluginPath(); err != nil {
c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err)) c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err))
return 1 return 1

View File

@ -18,11 +18,7 @@ type StateListCommand struct {
} }
func (c *StateListCommand) Run(args []string) int { func (c *StateListCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
var statePath string var statePath string
cmdFlags := c.Meta.defaultFlagSet("state list") cmdFlags := c.Meta.defaultFlagSet("state list")
cmdFlags.StringVar(&statePath, "state", "", "path") cmdFlags.StringVar(&statePath, "state", "", "path")

View File

@ -18,11 +18,7 @@ type StateMvCommand struct {
} }
func (c *StateMvCommand) Run(args []string) int { func (c *StateMvCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
// We create two metas to track the two states // We create two metas to track the two states
var backupPathOut, statePathOut string var backupPathOut, statePathOut string

View File

@ -16,11 +16,7 @@ type StatePullCommand struct {
} }
func (c *StatePullCommand) Run(args []string) int { func (c *StatePullCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.defaultFlagSet("state pull") cmdFlags := c.Meta.defaultFlagSet("state pull")
if err := cmdFlags.Parse(args); err != nil { if err := cmdFlags.Parse(args); err != nil {
c.Ui.Error(fmt.Sprintf("Error parsing command-line flags: %s\n", err.Error())) c.Ui.Error(fmt.Sprintf("Error parsing command-line flags: %s\n", err.Error()))

View File

@ -20,11 +20,7 @@ type StatePushCommand struct {
} }
func (c *StatePushCommand) Run(args []string) int { func (c *StatePushCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
var flagForce bool var flagForce bool
cmdFlags := c.Meta.defaultFlagSet("state push") cmdFlags := c.Meta.defaultFlagSet("state push")
cmdFlags.BoolVar(&flagForce, "force", false, "") cmdFlags.BoolVar(&flagForce, "force", false, "")

View File

@ -17,11 +17,7 @@ type StateRmCommand struct {
} }
func (c *StateRmCommand) Run(args []string) int { func (c *StateRmCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
var dryRun bool var dryRun bool
cmdFlags := c.Meta.defaultFlagSet("state rm") cmdFlags := c.Meta.defaultFlagSet("state rm")
cmdFlags.BoolVar(&dryRun, "dry-run", false, "dry run") cmdFlags.BoolVar(&dryRun, "dry-run", false, "dry run")

View File

@ -19,11 +19,7 @@ type StateShowCommand struct {
} }
func (c *StateShowCommand) Run(args []string) int { func (c *StateShowCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.defaultFlagSet("state show") cmdFlags := c.Meta.defaultFlagSet("state show")
cmdFlags.StringVar(&c.Meta.statePath, "state", "", "path") cmdFlags.StringVar(&c.Meta.statePath, "state", "", "path")
if err := cmdFlags.Parse(args); err != nil { if err := cmdFlags.Parse(args); err != nil {
@ -37,6 +33,7 @@ func (c *StateShowCommand) Run(args []string) int {
} }
// Check for user-supplied plugin path // Check for user-supplied plugin path
var err error
if c.pluginPath, err = c.loadPluginPath(); err != nil { if c.pluginPath, err = c.loadPluginPath(); err != nil {
c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err)) c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err))
return 1 return 1

View File

@ -18,11 +18,7 @@ type TaintCommand struct {
} }
func (c *TaintCommand) Run(args []string) int { func (c *TaintCommand) Run(args []string) int {
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
var module string var module string
var allowMissing bool var allowMissing bool
cmdFlags := c.Meta.defaultFlagSet("taint") cmdFlags := c.Meta.defaultFlagSet("taint")

View File

@ -19,11 +19,7 @@ type UnlockCommand struct {
} }
func (c *UnlockCommand) Run(args []string) int { func (c *UnlockCommand) Run(args []string) int {
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
var force bool var force bool
cmdFlags := c.Meta.defaultFlagSet("force-unlock") cmdFlags := c.Meta.defaultFlagSet("force-unlock")
cmdFlags.BoolVar(&force, "force", false, "force") cmdFlags.BoolVar(&force, "force", false, "force")

View File

@ -18,11 +18,7 @@ type UntaintCommand struct {
} }
func (c *UntaintCommand) Run(args []string) int { func (c *UntaintCommand) Run(args []string) int {
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
var module string var module string
var allowMissing bool var allowMissing bool
cmdFlags := c.Meta.defaultFlagSet("untaint") cmdFlags := c.Meta.defaultFlagSet("untaint")

View File

@ -20,11 +20,7 @@ type ValidateCommand struct {
const defaultPath = "." const defaultPath = "."
func (c *ValidateCommand) Run(args []string) int { func (c *ValidateCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
// TODO: The `var` and `var-file` options are not actually used, and should // TODO: The `var` and `var-file` options are not actually used, and should
// be removed in the next major release. // be removed in the next major release.
if c.Meta.variableArgs.items == nil { if c.Meta.variableArgs.items == nil {

View File

@ -35,11 +35,7 @@ func (c *VersionCommand) Help() string {
func (c *VersionCommand) Run(args []string) int { func (c *VersionCommand) Run(args []string) int {
var versionString bytes.Buffer var versionString bytes.Buffer
args, err := c.Meta.process(args, false) args = c.Meta.process(args)
if err != nil {
return 1
}
fmt.Fprintf(&versionString, "Terraform v%s", c.Version) fmt.Fprintf(&versionString, "Terraform v%s", c.Version)
if c.VersionPrerelease != "" { if c.VersionPrerelease != "" {
fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease) fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease)

View File

@ -15,11 +15,7 @@ type WorkspaceCommand struct {
} }
func (c *WorkspaceCommand) Run(args []string) int { func (c *WorkspaceCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
envCommandShowWarning(c.Ui, c.LegacyName) envCommandShowWarning(c.Ui, c.LegacyName)
cmdFlags := c.Meta.extendedFlagSet("workspace") cmdFlags := c.Meta.extendedFlagSet("workspace")

View File

@ -18,11 +18,7 @@ type WorkspaceDeleteCommand struct {
} }
func (c *WorkspaceDeleteCommand) Run(args []string) int { func (c *WorkspaceDeleteCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
envCommandShowWarning(c.Ui, c.LegacyName) envCommandShowWarning(c.Ui, c.LegacyName)
var force bool var force bool

View File

@ -15,11 +15,7 @@ type WorkspaceListCommand struct {
} }
func (c *WorkspaceListCommand) Run(args []string) int { func (c *WorkspaceListCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
envCommandShowWarning(c.Ui, c.LegacyName) envCommandShowWarning(c.Ui, c.LegacyName)
cmdFlags := c.Meta.defaultFlagSet("workspace list") cmdFlags := c.Meta.defaultFlagSet("workspace list")

View File

@ -20,11 +20,7 @@ type WorkspaceNewCommand struct {
} }
func (c *WorkspaceNewCommand) Run(args []string) int { func (c *WorkspaceNewCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
envCommandShowWarning(c.Ui, c.LegacyName) envCommandShowWarning(c.Ui, c.LegacyName)
var stateLock bool var stateLock bool

View File

@ -15,11 +15,7 @@ type WorkspaceSelectCommand struct {
} }
func (c *WorkspaceSelectCommand) Run(args []string) int { func (c *WorkspaceSelectCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
envCommandShowWarning(c.Ui, c.LegacyName) envCommandShowWarning(c.Ui, c.LegacyName)
cmdFlags := c.Meta.defaultFlagSet("workspace select") cmdFlags := c.Meta.defaultFlagSet("workspace select")

View File

@ -12,11 +12,7 @@ type WorkspaceShowCommand struct {
} }
func (c *WorkspaceShowCommand) Run(args []string) int { func (c *WorkspaceShowCommand) Run(args []string) int {
args, err := c.Meta.process(args, true) args = c.Meta.process(args)
if err != nil {
return 1
}
cmdFlags := c.Meta.extendedFlagSet("workspace show") cmdFlags := c.Meta.extendedFlagSet("workspace show")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil { if err := cmdFlags.Parse(args); err != nil {