Skip to content

Commit

Permalink
Standardize location of AddCommand(...) call (#228)
Browse files Browse the repository at this point in the history
All AddCommand(...) calls are now made from the sub-command which adds itself to its root / parent command.
  • Loading branch information
spew authored and k8s-ci-robot committed May 29, 2018
1 parent b455dce commit 107e3b3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clusterctl/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ var createCmd = &cobra.Command{
}

func init() {
createCmd.AddCommand(createClusterCmd)
RootCmd.AddCommand(createCmd)
}
1 change: 1 addition & 0 deletions clusterctl/cmd/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func init() {
// Optional flags
createClusterCmd.Flags().BoolVarP(&co.CleanupExternalCluster, "cleanup-external-cluster", "", true, "Whether to cleanup the external cluster after bootstrap")
createClusterCmd.Flags().StringVarP(&co.VmDriver, "vm-driver", "", "", "Which vm driver to use for minikube")
createCmd.AddCommand(createClusterCmd)
}

func parseClusterYaml(file string) (*clusterv1.Cluster, error) {
Expand Down
1 change: 0 additions & 1 deletion clusterctl/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ var deleteCmd = &cobra.Command{
}

func init() {
deleteCmd.AddCommand(NewCmdDeleteCluster())
RootCmd.AddCommand(deleteCmd)
}
4 changes: 4 additions & 0 deletions clusterctl/cmd/delete_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func NewCmdDeleteCluster() *cobra.Command {
return cmd
}

func init() {
deleteCmd.AddCommand(NewCmdDeleteCluster())
}

func RunDelete() error {
return errors.NotImplementedError
}
1 change: 0 additions & 1 deletion clusterctl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,4 @@ func init() {
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)

logs.InitLogs()
RootCmd.AddCommand(createCmd)
}

0 comments on commit 107e3b3

Please sign in to comment.