Skip to content

Commit

Permalink
cli: deprecate 'workspace create' command
Browse files Browse the repository at this point in the history
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
  • Loading branch information
sttts committed Aug 17, 2024
1 parent 89ae53b commit 2e73395
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cli/cmd/kubectl-create-workspace/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
flags := pflag.NewFlagSet("kubectl-create-workspace", pflag.ExitOnError)
pflag.CommandLine = flags

createWorkspaceCmd, err := cmd.NewCreate("kubectl create workspace", genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr})
createWorkspaceCmd, err := cmd.NewCreate("kubectl create workspace", "", genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr})
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
Expand Down
5 changes: 3 additions & 2 deletions cli/pkg/workspace/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func New(streams genericclioptions.IOStreams) (*cobra.Command, error) {
}
currentWorkspaceOpts.BindFlags(currentCmd)

createCmd, err := NewCreate(cliName+" workspace create", streams)
createCmd, err := NewCreate(cliName+" workspace create", "install the 'kubectl create workspace' plugin instead, compare https://docs.kcp.io/kcp/latest/setup/kubectl-plugin/.", streams)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -206,12 +206,13 @@ func New(streams genericclioptions.IOStreams) (*cobra.Command, error) {
}

// NewCreate returns a cobra.Command for workspace create action.
func NewCreate(prefix string, streams genericclioptions.IOStreams) (*cobra.Command, error) {
func NewCreate(prefix string, deprecation string, streams genericclioptions.IOStreams) (*cobra.Command, error) {
createWorkspaceOpts := plugin.NewCreateWorkspaceOptions(streams)
cmd := &cobra.Command{
Use: "create",
Short: "Creates a new workspace",
Example: prefix + " <workspace name> [--type=<type>] [--enter [--ignore-not-ready]] --ignore-existing",
Deprecated: deprecation,
SilenceUsage: true,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down

0 comments on commit 2e73395

Please sign in to comment.