mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-18 13:16:08 +00:00
use cobra's arg-count validation & call Complete() before Validate()
Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
@@ -50,11 +50,8 @@ func NewAddCommand(f client.Factory) *cobra.Command {
|
||||
c := &cobra.Command{
|
||||
Use: "add IMAGE",
|
||||
Short: "Add a plugin",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
if len(args) != 1 {
|
||||
cmd.CheckError(errors.New("you must specify only one argument, the plugin container image"))
|
||||
}
|
||||
|
||||
kubeClient, err := f.KubeClient()
|
||||
if err != nil {
|
||||
cmd.CheckError(err)
|
||||
|
||||
@@ -35,11 +35,8 @@ func NewRemoveCommand(f client.Factory) *cobra.Command {
|
||||
c := &cobra.Command{
|
||||
Use: "remove [NAME | IMAGE]",
|
||||
Short: "Remove a plugin",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
if len(args) != 1 {
|
||||
cmd.CheckError(errors.New("you must specify only one argument, the plugin container's name or image"))
|
||||
}
|
||||
|
||||
kubeClient, err := f.KubeClient()
|
||||
if err != nil {
|
||||
cmd.CheckError(err)
|
||||
|
||||
Reference in New Issue
Block a user