diff --git a/cmd/create/create.go b/cmd/create/create.go index 5173878f..388cf6a3 100644 --- a/cmd/create/create.go +++ b/cmd/create/create.go @@ -33,4 +33,7 @@ func init() { Cmd.PersistentFlags().StringVarP(&pkg.Options.WorkspaceID, "instance-id", "i", "", "Instance ID of the PowerVS instance") Cmd.PersistentFlags().MarkDeprecated("instance-id", "instance-id is deprecated, workspace-id should be used") Cmd.PersistentFlags().StringVarP(&pkg.Options.WorkspaceID, "workspace-id", "", "", "Workspace ID of the PowerVS workspace") + Cmd.PersistentFlags().StringVarP(&pkg.Options.WorkspaceName, "instance-name", "n", "", "Instance name of the PowerVS instance") + Cmd.PersistentFlags().MarkDeprecated("instance-name", "instance-name is deprecated, workspace-name should be used") + Cmd.PersistentFlags().StringVarP(&pkg.Options.WorkspaceName, "workspace-name", "", "", "Workspace name of the PowerVS workspace") } diff --git a/cmd/create/port/port.go b/cmd/create/port/port.go index 99e4c3bc..695a3784 100644 --- a/cmd/create/port/port.go +++ b/cmd/create/port/port.go @@ -36,10 +36,7 @@ var Cmd = &cobra.Command{ Short: "Create PowerVS network port", Long: `Create PowerVS network port`, PreRunE: func(cmd *cobra.Command, args []string) error { - if pkg.Options.WorkspaceID == "" { - return fmt.Errorf("--workspace-id required") - } - return nil + return utils.EnsureWorkspaceIDorNameIsSet(pkg.Options.WorkspaceID, pkg.Options.WorkspaceName) }, RunE: func(cmd *cobra.Command, args []string) error { opt := pkg.Options