Skip to content

Commit

Permalink
Uniformate init methods for commands
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Vito Moscaritolo <[email protected]>
  • Loading branch information
mavimo committed Nov 21, 2018
1 parent 4173c45 commit 95868e2
Show file tree
Hide file tree
Showing 18 changed files with 10 additions and 122 deletions.
1 change: 1 addition & 0 deletions cmd/cluster_add_external_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ An external server must meet the following requirements:

func init() {
clusterCmd.AddCommand(clusterAddExternalWorkerCmd)

clusterAddExternalWorkerCmd.Flags().StringP("name", "n", "", "Name of the cluster to add the workers to")
clusterAddExternalWorkerCmd.Flags().StringP("ip", "i", "", "The IP address of the external node")
}
1 change: 1 addition & 0 deletions cmd/cluster_add_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ You can specify the worker server type as in cluster create.`,

func init() {
clusterCmd.AddCommand(clusterAddWorkerCmd)

clusterAddWorkerCmd.Flags().StringP("name", "", "", "Name of the cluster to add the workers to")
clusterAddWorkerCmd.Flags().String("worker-server-type", "cx11", "Server type used of workers")
clusterAddWorkerCmd.Flags().IntP("nodes", "n", 2, "Number of nodes for the cluster")
Expand Down
2 changes: 1 addition & 1 deletion cmd/cluster_addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ var clusterAddonCmd = &cobra.Command{

func init() {
clusterCmd.AddCommand(clusterAddonCmd)

}

func validateAddonSubCommand(cmd *cobra.Command, args []string) error {
name, err := cmd.Flags().GetString("name")
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/cluster_addon_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ var clusterAddonInstallCmd = &cobra.Command{

func init() {
clusterAddonCmd.AddCommand(clusterAddonInstallCmd)

clusterAddonInstallCmd.Flags().StringP("name", "n", "", "Name of the cluster")
}
1 change: 1 addition & 0 deletions cmd/cluster_addon_uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ var clusterAddonUninstallCmd = &cobra.Command{

func init() {
clusterAddonCmd.AddCommand(clusterAddonUninstallCmd)

clusterAddonUninstallCmd.Flags().StringP("name", "n", "", "Name of the cluster")
}
11 changes: 1 addition & 10 deletions cmd/cluster_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@ var clusterDeleteCmd = &cobra.Command{

func init() {
clusterCmd.AddCommand(clusterDeleteCmd)
clusterDeleteCmd.Flags().StringP("name", "n", "", "Name of the cluster to delete")

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// clusterDeleteCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// clusterDeleteCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
clusterDeleteCmd.Flags().StringP("name", "n", "", "Name of the cluster to delete")
}
10 changes: 0 additions & 10 deletions cmd/cluster_kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,4 @@ func init() {
clusterKubeconfigCmd.Flags().BoolP("print", "p", false, "prints output to stdout")
clusterKubeconfigCmd.Flags().BoolP("backup", "b", false, "saves existing config")
clusterKubeconfigCmd.Flags().BoolP("force", "f", false, "don't ask to overwrite")

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// clusterKubeconfigCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// clusterKubeconfigCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
10 changes: 0 additions & 10 deletions cmd/cluster_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,4 @@ var clusterListCmd = &cobra.Command{

func init() {
clusterCmd.AddCommand(clusterListCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// clusterListCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// clusterListCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
2 changes: 1 addition & 1 deletion cmd/cluster_remove_external_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var clusterRemoveExternalWorkerCmd = &cobra.Command{

func init() {
clusterCmd.AddCommand(clusterRemoveExternalWorkerCmd)

clusterRemoveExternalWorkerCmd.Flags().StringP("name", "n", "", "Name of the cluster where to remove the worker")
clusterRemoveExternalWorkerCmd.Flags().StringP("ip", "i", "", "The IP address of the external node")

}
10 changes: 0 additions & 10 deletions cmd/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,4 @@ var contextCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(contextCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// contextCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// contextCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
10 changes: 0 additions & 10 deletions cmd/context_current.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,4 @@ var currentCmd = &cobra.Command{

func init() {
contextCmd.AddCommand(currentCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// currentCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// currentCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
10 changes: 0 additions & 10 deletions cmd/context_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,4 @@ var contextDeleteCmd = &cobra.Command{

func init() {
contextCmd.AddCommand(contextDeleteCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// addCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// addCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
10 changes: 0 additions & 10 deletions cmd/context_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,4 @@ var listCmd = &cobra.Command{

func init() {
contextCmd.AddCommand(listCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// listCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// listCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
10 changes: 0 additions & 10 deletions cmd/context_use.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,4 @@ var useCmd = &cobra.Command{

func init() {
contextCmd.AddCommand(useCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// useCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// useCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
11 changes: 1 addition & 10 deletions cmd/ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ Note, that the private key never gets uploaded anywhere. The path is used to con

func init() {
rootCmd.AddCommand(sshKeyCmd)
sshKeyCmd.Flags().StringP("name", "n", "", "")

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// sshKeyCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// sshKeyCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
sshKeyCmd.Flags().StringP("name", "n", "", "")
}
11 changes: 1 addition & 10 deletions cmd/ssh_key_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,8 @@ func validateFlags(cmd *cobra.Command, args []string) error {

func init() {
sshKeyCmd.AddCommand(sshKeyAddCmd)

sshKeyAddCmd.Flags().StringP("name", "n", "", "the name of the key")
sshKeyAddCmd.Flags().String("private-key-path", "~/.ssh/id_rsa", "the path to the private key")
sshKeyAddCmd.Flags().String("public-key-path", "~/.ssh/id_rsa.pub", "the path to the public key")

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// sshKeyAddCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// sshKeyAddCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
11 changes: 1 addition & 10 deletions cmd/ssh_key_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@ func validateSHHKeyDeleteFlags(cmd *cobra.Command, args []string) error {
}
func init() {
sshKeyCmd.AddCommand(sshKeyDeleteCmd)
sshKeyDeleteCmd.Flags().StringP("name", "n", "", "Name of the ssh-key")

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// sshKeyDeleteCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// sshKeyDeleteCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
sshKeyDeleteCmd.Flags().StringP("name", "n", "", "Name of the ssh-key")
}
10 changes: 0 additions & 10 deletions cmd/ssh_key_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,4 @@ to quickly create a Cobra application.`,

func init() {
sshKeyCmd.AddCommand(sshKeyListCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// sshKeyListCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// sshKeyListCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}

0 comments on commit 95868e2

Please sign in to comment.