Skip to content

Commit

Permalink
add override to remove autogenerated apps resource command (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
suz-stripe committed Jun 1, 2022
1 parent ba45b60 commit 676158b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/cmd/resource/apps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package resource

import (
"github.com/spf13/cobra"
)

// RemoveAppsCmd removes the autogenerated `apps` command as we need the plugin to have this namespace
func RemoveAppsCmd(rootCmd *cobra.Command) error {
for _, cmd := range rootCmd.Commands() {
if cmd.Use == "apps" {
// Remove the autogenerated in favor of the plugin
rootCmd.RemoveCommand(cmd)
break
}
}

return nil
}
3 changes: 3 additions & 0 deletions pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ func init() {
log.Fatal(err)
}

// remove autogenerated apps command
resource.RemoveAppsCmd(rootCmd)

// config is not initialized by cobra at this point, so we need to temporarily initialize it
Config.InitConfig()

Expand Down

0 comments on commit 676158b

Please sign in to comment.