diff --git a/lxc/action.go b/lxc/action.go index 086e652f1bdd..7aeafcb0563d 100644 --- a/lxc/action.go +++ b/lxc/action.go @@ -20,9 +20,9 @@ type cmdStart struct { action *cmdAction } -// The function Command() returns a cobra.Command object representing the "start" command. +// The function command() returns a cobra.Command object representing the "start" command. // It is used to start one or more instances specified by the user. -func (c *cmdStart) Command() *cobra.Command { +func (c *cmdStart) command() *cobra.Command { cmdAction := cmdAction{global: c.global} c.action = &cmdAction @@ -41,9 +41,9 @@ type cmdPause struct { action *cmdAction } -// The function Command() returns a cobra.Command object representing the "pause" command. +// The function command() returns a cobra.Command object representing the "pause" command. // It is used to pause (or freeze) one or more instances specified by the user. This command is hidden and has an alias "freeze". -func (c *cmdPause) Command() *cobra.Command { +func (c *cmdPause) command() *cobra.Command { cmdAction := cmdAction{global: c.global} c.action = &cmdAction @@ -63,9 +63,9 @@ type cmdRestart struct { action *cmdAction } -// The function Command() returns a cobra.Command object representing the "restart" command. +// The function command() returns a cobra.Command object representing the "restart" command. // It is used to restart one or more instances specified by the user. This command restarts the instances, which is the opposite of the "pause" command. -func (c *cmdRestart) Command() *cobra.Command { +func (c *cmdRestart) command() *cobra.Command { cmdAction := cmdAction{global: c.global} c.action = &cmdAction @@ -86,9 +86,9 @@ type cmdStop struct { action *cmdAction } -// The function Command() returns a cobra.Command object representing the "stop" command. +// The function command() returns a cobra.Command object representing the "stop" command. // It is used to stop one or more instances specified by the user. This command stops the instances, effectively shutting them down. -func (c *cmdStop) Command() *cobra.Command { +func (c *cmdStop) command() *cobra.Command { cmdAction := cmdAction{global: c.global} c.action = &cmdAction @@ -116,7 +116,7 @@ type cmdAction struct { // It creates a command with a specific action, defines flags based on that action, and assigns appropriate help text. func (c *cmdAction) Command(action string) *cobra.Command { cmd := &cobra.Command{} - cmd.RunE = c.Run + cmd.RunE = c.run cmd.Flags().BoolVar(&c.flagAll, "all", false, i18n.G("Run against all instances")) @@ -302,7 +302,7 @@ func (c *cmdAction) doAction(action string, conf *config.Config, nameArg string) // Run is a method of the cmdAction structure that implements the execution logic for the given Cobra command. // It handles actions on instances (single or all) and manages error handling, console flag restrictions, and batch operations. -func (c *cmdAction) Run(cmd *cobra.Command, args []string) error { +func (c *cmdAction) run(cmd *cobra.Command, args []string) error { conf := c.global.conf var names []string diff --git a/lxc/alias.go b/lxc/alias.go index 4368ca978e49..67a0c491f35e 100644 --- a/lxc/alias.go +++ b/lxc/alias.go @@ -16,7 +16,7 @@ type cmdAlias struct { // Command is a method of the cmdAlias structure that returns a new cobra Command for managing command aliases. // This includes commands for adding, listing, renaming, and removing aliases, along with their usage and descriptions. -func (c *cmdAlias) Command() *cobra.Command { +func (c *cmdAlias) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("alias") cmd.Short = i18n.G("Manage command aliases") @@ -25,19 +25,19 @@ func (c *cmdAlias) Command() *cobra.Command { // Add aliasAddCmd := cmdAliasAdd{global: c.global, alias: c} - cmd.AddCommand(aliasAddCmd.Command()) + cmd.AddCommand(aliasAddCmd.command()) // List aliasListCmd := cmdAliasList{global: c.global, alias: c} - cmd.AddCommand(aliasListCmd.Command()) + cmd.AddCommand(aliasListCmd.command()) // Rename aliasRenameCmd := cmdAliasRename{global: c.global, alias: c} - cmd.AddCommand(aliasRenameCmd.Command()) + cmd.AddCommand(aliasRenameCmd.command()) // Remove aliasRemoveCmd := cmdAliasRemove{global: c.global, alias: c} - cmd.AddCommand(aliasRemoveCmd.Command()) + cmd.AddCommand(aliasRemoveCmd.command()) // Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706 cmd.Args = cobra.NoArgs @@ -53,7 +53,7 @@ type cmdAliasAdd struct { // Command is a method of the cmdAliasAdd structure that returns a new cobra Command for adding new command aliases. // It specifies the command usage, description, and examples, and links it to the RunE method for execution logic. -func (c *cmdAliasAdd) Command() *cobra.Command { +func (c *cmdAliasAdd) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("add", i18n.G(" ")) cmd.Short = i18n.G("Add new aliases") @@ -63,14 +63,14 @@ func (c *cmdAliasAdd) Command() *cobra.Command { `lxc alias add list "list -c ns46S" Overwrite the "list" command to pass -c ns46S.`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run is a method of the cmdAliasAdd structure. It implements the logic to add a new alias command. // The function checks for valid arguments, verifies if the alias already exists, and if not, adds the new alias to the configuration. -func (c *cmdAliasAdd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdAliasAdd) run(cmd *cobra.Command, args []string) error { conf := c.global.conf // Quick checks. @@ -102,7 +102,7 @@ type cmdAliasList struct { // Command is a method of the cmdAliasList structure that returns a new cobra Command for listing command aliases. // It specifies the command usage, description, aliases, and output formatting options, and links it to the RunE method for execution logic. -func (c *cmdAliasList) Command() *cobra.Command { +func (c *cmdAliasList) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("list") cmd.Aliases = []string{"ls"} @@ -111,14 +111,14 @@ func (c *cmdAliasList) Command() *cobra.Command { `List aliases`)) cmd.Flags().StringVarP(&c.flagFormat, "format", "f", "table", i18n.G("Format (csv|json|table|yaml|compact)")+"``") - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run is a method of the cmdAliasList structure. It implements the logic to list existing command aliases. // The function checks for valid arguments, collects all the aliases, sorts them, and renders them in the specified format. -func (c *cmdAliasList) Run(cmd *cobra.Command, args []string) error { +func (c *cmdAliasList) run(cmd *cobra.Command, args []string) error { conf := c.global.conf // Quick checks. @@ -151,7 +151,7 @@ type cmdAliasRename struct { // Command is a method of the cmdAliasRename structure. It returns a new cobra.Command object. // This command allows a user to rename existing aliases in the CLI application. -func (c *cmdAliasRename) Command() *cobra.Command { +func (c *cmdAliasRename) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("rename", i18n.G(" ")) cmd.Aliases = []string{"mv"} @@ -162,14 +162,14 @@ func (c *cmdAliasRename) Command() *cobra.Command { `lxc alias rename list my-list Rename existing alias "list" to "my-list".`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run is a method of the cmdAliasRename structure. It takes a cobra command and a slice of strings as arguments. // This method checks the validity of arguments, ensures the existence of the old alias, verifies the non-existence of the new alias, and then proceeds to rename the alias in the configuration. -func (c *cmdAliasRename) Run(cmd *cobra.Command, args []string) error { +func (c *cmdAliasRename) run(cmd *cobra.Command, args []string) error { conf := c.global.conf // Quick checks. @@ -206,7 +206,7 @@ type cmdAliasRemove struct { // Command is a method of the cmdAliasRemove structure. It configures and returns a cobra.Command object. // This command enables the removal of a given alias from the command line interface. -func (c *cmdAliasRemove) Command() *cobra.Command { +func (c *cmdAliasRemove) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("remove", i18n.G("")) cmd.Aliases = []string{"rm"} @@ -217,14 +217,14 @@ func (c *cmdAliasRemove) Command() *cobra.Command { `lxc alias remove my-list Remove the "my-list" alias.`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run is a method of the cmdAliasRemove structure that executes the actual operation of the alias removal command. // It takes as input the name of the alias to be removed and updates the global configuration file to reflect this change. -func (c *cmdAliasRemove) Run(cmd *cobra.Command, args []string) error { +func (c *cmdAliasRemove) run(cmd *cobra.Command, args []string) error { conf := c.global.conf // Quick checks. diff --git a/lxc/cluster.go b/lxc/cluster.go index e768fb7982ee..e3429a194f83 100644 --- a/lxc/cluster.go +++ b/lxc/cluster.go @@ -22,7 +22,7 @@ type cmdCluster struct { global *cmdGlobal } -func (c *cmdCluster) Command() *cobra.Command { +func (c *cmdCluster) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("cluster") cmd.Short = i18n.G("Manage cluster members") @@ -31,73 +31,73 @@ func (c *cmdCluster) Command() *cobra.Command { // List clusterListCmd := cmdClusterList{global: c.global, cluster: c} - cmd.AddCommand(clusterListCmd.Command()) + cmd.AddCommand(clusterListCmd.command()) // Rename clusterRenameCmd := cmdClusterRename{global: c.global, cluster: c} - cmd.AddCommand(clusterRenameCmd.Command()) + cmd.AddCommand(clusterRenameCmd.command()) // Remove clusterRemoveCmd := cmdClusterRemove{global: c.global, cluster: c} - cmd.AddCommand(clusterRemoveCmd.Command()) + cmd.AddCommand(clusterRemoveCmd.command()) // Show clusterShowCmd := cmdClusterShow{global: c.global, cluster: c} - cmd.AddCommand(clusterShowCmd.Command()) + cmd.AddCommand(clusterShowCmd.command()) // Info clusterInfoCmd := cmdClusterInfo{global: c.global, cluster: c} - cmd.AddCommand(clusterInfoCmd.Command()) + cmd.AddCommand(clusterInfoCmd.command()) // Get clusterGetCmd := cmdClusterGet{global: c.global, cluster: c} - cmd.AddCommand(clusterGetCmd.Command()) + cmd.AddCommand(clusterGetCmd.command()) // Set clusterSetCmd := cmdClusterSet{global: c.global, cluster: c} - cmd.AddCommand(clusterSetCmd.Command()) + cmd.AddCommand(clusterSetCmd.command()) // Unset clusterUnsetCmd := cmdClusterUnset{global: c.global, cluster: c, clusterSet: &clusterSetCmd} - cmd.AddCommand(clusterUnsetCmd.Command()) + cmd.AddCommand(clusterUnsetCmd.command()) // Enable clusterEnableCmd := cmdClusterEnable{global: c.global, cluster: c} - cmd.AddCommand(clusterEnableCmd.Command()) + cmd.AddCommand(clusterEnableCmd.command()) // Edit clusterEditCmd := cmdClusterEdit{global: c.global, cluster: c} - cmd.AddCommand(clusterEditCmd.Command()) + cmd.AddCommand(clusterEditCmd.command()) // Add token cmdClusterAdd := cmdClusterAdd{global: c.global, cluster: c} - cmd.AddCommand(cmdClusterAdd.Command()) + cmd.AddCommand(cmdClusterAdd.command()) // List tokens cmdClusterListTokens := cmdClusterListTokens{global: c.global, cluster: c} - cmd.AddCommand(cmdClusterListTokens.Command()) + cmd.AddCommand(cmdClusterListTokens.command()) // Revoke tokens cmdClusterRevokeToken := cmdClusterRevokeToken{global: c.global, cluster: c} - cmd.AddCommand(cmdClusterRevokeToken.Command()) + cmd.AddCommand(cmdClusterRevokeToken.command()) // Update certificate cmdClusterUpdateCertificate := cmdClusterUpdateCertificate{global: c.global, cluster: c} - cmd.AddCommand(cmdClusterUpdateCertificate.Command()) + cmd.AddCommand(cmdClusterUpdateCertificate.command()) // Evacuate cluster member cmdClusterEvacuate := cmdClusterEvacuate{global: c.global, cluster: c} - cmd.AddCommand(cmdClusterEvacuate.Command()) + cmd.AddCommand(cmdClusterEvacuate.command()) // Restore cluster member cmdClusterRestore := cmdClusterRestore{global: c.global, cluster: c} - cmd.AddCommand(cmdClusterRestore.Command()) + cmd.AddCommand(cmdClusterRestore.command()) clusterGroupCmd := cmdClusterGroup{global: c.global, cluster: c} - cmd.AddCommand(clusterGroupCmd.Command()) + cmd.AddCommand(clusterGroupCmd.command()) clusterRoleCmd := cmdClusterRole{global: c.global, cluster: c} - cmd.AddCommand(clusterRoleCmd.Command()) + cmd.AddCommand(clusterRoleCmd.command()) // Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706 cmd.Args = cobra.NoArgs @@ -114,7 +114,7 @@ type cmdClusterList struct { flagFormat string } -func (c *cmdClusterList) Command() *cobra.Command { +func (c *cmdClusterList) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("list", i18n.G("[:]")) cmd.Aliases = []string{"ls"} @@ -123,12 +123,12 @@ func (c *cmdClusterList) Command() *cobra.Command { `List all the cluster members`)) cmd.Flags().StringVarP(&c.flagFormat, "format", "f", "table", i18n.G("Format (csv|json|table|yaml|compact)")+"``") - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterList) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterList) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 0, 1) if exit { @@ -199,19 +199,19 @@ type cmdClusterShow struct { cluster *cmdCluster } -func (c *cmdClusterShow) Command() *cobra.Command { +func (c *cmdClusterShow) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("show", i18n.G("[:]")) cmd.Short = i18n.G("Show details of a cluster member") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Show details of a cluster member`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterShow) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterShow) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -248,19 +248,19 @@ type cmdClusterInfo struct { cluster *cmdCluster } -func (c *cmdClusterInfo) Command() *cobra.Command { +func (c *cmdClusterInfo) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("info", i18n.G("[:]")) cmd.Short = i18n.G("Show useful information about a cluster member") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Show useful information about a cluster member`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterInfo) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterInfo) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -299,19 +299,19 @@ type cmdClusterGet struct { flagIsProperty bool } -func (c *cmdClusterGet) Command() *cobra.Command { +func (c *cmdClusterGet) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("get", i18n.G("[:] ")) cmd.Short = i18n.G("Get values for cluster member configuration keys") cmd.Long = cli.FormatSection(i18n.G("Description"), cmd.Short) cmd.Flags().BoolVarP(&c.flagIsProperty, "property", "p", false, i18n.G("Get the key as a cluster property")) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterGet) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGet) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { @@ -360,19 +360,19 @@ type cmdClusterSet struct { flagIsProperty bool } -func (c *cmdClusterSet) Command() *cobra.Command { +func (c *cmdClusterSet) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("set", i18n.G("[:] =...")) cmd.Short = i18n.G("Set a cluster member's configuration keys") cmd.Long = cli.FormatSection(i18n.G("Description"), cmd.Short) cmd.Flags().BoolVarP(&c.flagIsProperty, "property", "p", false, i18n.G("Set the key as a cluster property")) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterSet) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterSet) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, -1) if exit { @@ -432,19 +432,19 @@ type cmdClusterUnset struct { flagIsProperty bool } -func (c *cmdClusterUnset) Command() *cobra.Command { +func (c *cmdClusterUnset) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("unset", i18n.G("[:] ")) cmd.Short = i18n.G("Unset a cluster member's configuration keys") cmd.Long = cli.FormatSection(i18n.G("Description"), cmd.Short) cmd.Flags().BoolVarP(&c.flagIsProperty, "property", "p", false, i18n.G("Unset the key as a cluster property")) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterUnset) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterUnset) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { @@ -454,7 +454,7 @@ func (c *cmdClusterUnset) Run(cmd *cobra.Command, args []string) error { c.clusterSet.flagIsProperty = c.flagIsProperty args = append(args, "") - return c.clusterSet.Run(cmd, args) + return c.clusterSet.run(cmd, args) } // Rename. @@ -463,7 +463,7 @@ type cmdClusterRename struct { cluster *cmdCluster } -func (c *cmdClusterRename) Command() *cobra.Command { +func (c *cmdClusterRename) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("rename", i18n.G("[:] ")) cmd.Aliases = []string{"mv"} @@ -471,12 +471,12 @@ func (c *cmdClusterRename) Command() *cobra.Command { cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Rename a cluster member`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterRename) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterRename) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { @@ -513,7 +513,7 @@ type cmdClusterRemove struct { flagNonInteractive bool } -func (c *cmdClusterRemove) Command() *cobra.Command { +func (c *cmdClusterRemove) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("remove", i18n.G("[:]")) cmd.Aliases = []string{"rm"} @@ -521,7 +521,7 @@ func (c *cmdClusterRemove) Command() *cobra.Command { cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Remove a member from the cluster`)) - cmd.RunE = c.Run + cmd.RunE = c.run cmd.Flags().BoolVarP(&c.flagForce, "force", "f", false, i18n.G("Force removing a member, even if degraded")) cmd.Flags().BoolVar(&c.flagNonInteractive, "yes", false, i18n.G("Don't require user confirmation for using --force")) @@ -555,7 +555,7 @@ Are you really sure you want to force removing %s? (yes/no): `), name) return nil } -func (c *cmdClusterRemove) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterRemove) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -597,7 +597,7 @@ type cmdClusterEnable struct { cluster *cmdCluster } -func (c *cmdClusterEnable) Command() *cobra.Command { +func (c *cmdClusterEnable) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("enable", i18n.G("[:] ")) cmd.Short = i18n.G("Enable clustering on a single non-clustered LXD server") @@ -611,12 +611,12 @@ func (c *cmdClusterEnable) Command() *cobra.Command { that by running 'lxc config get core.https_address', and possibly set a value for the address if not yet set.`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterEnable) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterEnable) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 2) if exit { @@ -682,7 +682,7 @@ type cmdClusterEdit struct { cluster *cmdCluster } -func (c *cmdClusterEdit) Command() *cobra.Command { +func (c *cmdClusterEdit) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("edit", i18n.G("[:]")) cmd.Short = i18n.G("Edit cluster member configurations as YAML") @@ -692,7 +692,7 @@ func (c *cmdClusterEdit) Command() *cobra.Command { `lxc cluster edit < member.yaml Update a cluster member using the content of member.yaml`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } @@ -703,7 +703,7 @@ func (c *cmdClusterEdit) helpTemplate() string { ### Any line starting with a '# will be ignored.`) } -func (c *cmdClusterEdit) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterEdit) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -797,19 +797,19 @@ type cmdClusterAdd struct { flagName string } -func (c *cmdClusterAdd) Command() *cobra.Command { +func (c *cmdClusterAdd) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("add", i18n.G("[[:]]")) cmd.Short = i18n.G("Request a join token for adding a cluster member") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G(`Request a join token for adding a cluster member`)) cmd.Flags().StringVar(&c.flagName, "name", "", i18n.G("Cluster member name (alternative to passing it as an argument)")+"``") - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterAdd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterAdd) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -873,19 +873,19 @@ type cmdClusterListTokens struct { flagFormat string } -func (c *cmdClusterListTokens) Command() *cobra.Command { +func (c *cmdClusterListTokens) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("list-tokens", i18n.G("[:]")) cmd.Short = i18n.G("List all active cluster member join tokens") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G(`List all active cluster member join tokens`)) cmd.Flags().StringVarP(&c.flagFormat, "format", "f", "table", i18n.G("Format (csv|json|table|yaml|compact)")+"``") - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterListTokens) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterListTokens) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 0, 1) if exit { @@ -975,17 +975,17 @@ type cmdClusterRevokeToken struct { cluster *cmdCluster } -func (c *cmdClusterRevokeToken) Command() *cobra.Command { +func (c *cmdClusterRevokeToken) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("revoke-token", i18n.G("[:]")) cmd.Short = i18n.G("Revoke cluster member join token") cmd.Long = cli.FormatSection(i18n.G("Description"), cmd.Short) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterRevokeToken) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterRevokeToken) run(cmd *cobra.Command, args []string) error { exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { return err @@ -1053,7 +1053,7 @@ type cmdClusterUpdateCertificate struct { cluster *cmdCluster } -func (c *cmdClusterUpdateCertificate) Command() *cobra.Command { +func (c *cmdClusterUpdateCertificate) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("update-certificate", i18n.G("[:] ")) cmd.Aliases = []string{"update-cert"} @@ -1061,11 +1061,11 @@ func (c *cmdClusterUpdateCertificate) Command() *cobra.Command { cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G("Update cluster certificate with PEM certificate and key read from input files.")) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterUpdateCertificate) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterUpdateCertificate) run(cmd *cobra.Command, args []string) error { conf := c.global.conf exit, err := c.global.CheckArgs(cmd, args, 2, 3) @@ -1157,7 +1157,7 @@ type cmdClusterEvacuate struct { action *cmdClusterEvacuateAction } -func (c *cmdClusterEvacuate) Command() *cobra.Command { +func (c *cmdClusterEvacuate) command() *cobra.Command { cmdAction := cmdClusterEvacuateAction{global: c.global} c.action = &cmdAction @@ -1180,7 +1180,7 @@ type cmdClusterRestore struct { action *cmdClusterEvacuateAction } -func (c *cmdClusterRestore) Command() *cobra.Command { +func (c *cmdClusterRestore) command() *cobra.Command { cmdAction := cmdClusterEvacuateAction{global: c.global} c.action = &cmdAction @@ -1196,12 +1196,12 @@ func (c *cmdClusterRestore) Command() *cobra.Command { func (c *cmdClusterEvacuateAction) Command(action string) *cobra.Command { cmd := &cobra.Command{} - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterEvacuateAction) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterEvacuateAction) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { diff --git a/lxc/cluster_group.go b/lxc/cluster_group.go index d4f723f51404..11f5c1eeb2dc 100644 --- a/lxc/cluster_group.go +++ b/lxc/cluster_group.go @@ -23,7 +23,7 @@ type cmdClusterGroup struct { } // Cluster management including assignment, creation, deletion, editing, listing, removal, renaming, and showing details. -func (c *cmdClusterGroup) Command() *cobra.Command { +func (c *cmdClusterGroup) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("group") cmd.Short = i18n.G("Manage cluster groups") @@ -32,39 +32,39 @@ func (c *cmdClusterGroup) Command() *cobra.Command { // Assign clusterGroupAssignCmd := cmdClusterGroupAssign{global: c.global, cluster: c.cluster} - cmd.AddCommand(clusterGroupAssignCmd.Command()) + cmd.AddCommand(clusterGroupAssignCmd.command()) // Create clusterGroupCreateCmd := cmdClusterGroupCreate{global: c.global, cluster: c.cluster} - cmd.AddCommand(clusterGroupCreateCmd.Command()) + cmd.AddCommand(clusterGroupCreateCmd.command()) // Delete clusterGroupDeleteCmd := cmdClusterGroupDelete{global: c.global, cluster: c.cluster} - cmd.AddCommand(clusterGroupDeleteCmd.Command()) + cmd.AddCommand(clusterGroupDeleteCmd.command()) // Edit clusterGroupEditCmd := cmdClusterGroupEdit{global: c.global, cluster: c.cluster} - cmd.AddCommand(clusterGroupEditCmd.Command()) + cmd.AddCommand(clusterGroupEditCmd.command()) // List clusterGroupListCmd := cmdClusterGroupList{global: c.global, cluster: c.cluster} - cmd.AddCommand(clusterGroupListCmd.Command()) + cmd.AddCommand(clusterGroupListCmd.command()) // Remove clusterGroupRemoveCmd := cmdClusterGroupRemove{global: c.global, cluster: c.cluster} - cmd.AddCommand(clusterGroupRemoveCmd.Command()) + cmd.AddCommand(clusterGroupRemoveCmd.command()) // Rename clusterGroupRenameCmd := cmdClusterGroupRename{global: c.global, cluster: c.cluster} - cmd.AddCommand(clusterGroupRenameCmd.Command()) + cmd.AddCommand(clusterGroupRenameCmd.command()) // Show clusterGroupShowCmd := cmdClusterGroupShow{global: c.global, cluster: c.cluster} - cmd.AddCommand(clusterGroupShowCmd.Command()) + cmd.AddCommand(clusterGroupShowCmd.command()) // Add clusterGroupAddCmd := cmdClusterGroupAdd{global: c.global, cluster: c.cluster} - cmd.AddCommand(clusterGroupAddCmd.Command()) + cmd.AddCommand(clusterGroupAddCmd.command()) return cmd } @@ -76,7 +76,7 @@ type cmdClusterGroupAssign struct { } // Setting a groups to cluster members, setting usage, description, examples, and the RunE method. -func (c *cmdClusterGroupAssign) Command() *cobra.Command { +func (c *cmdClusterGroupAssign) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("assign", i18n.G("[:] ")) cmd.Aliases = []string{"apply"} @@ -90,13 +90,13 @@ func (c *cmdClusterGroupAssign) Command() *cobra.Command { lxc cluster group assign foo default Reset "foo" to only using the "default" cluster group.`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Groups assigning to a cluster member, performing checks, parsing arguments, and updating the member's group configuration. -func (c *cmdClusterGroupAssign) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGroupAssign) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { @@ -150,20 +150,20 @@ type cmdClusterGroupCreate struct { } // Creation of a new cluster group, defining its usage, short and long descriptions, and the RunE method. -func (c *cmdClusterGroupCreate) Command() *cobra.Command { +func (c *cmdClusterGroupCreate) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("create", i18n.G("[:]")) cmd.Short = i18n.G("Create a cluster group") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Create a cluster group`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // It creates new cluster group after performing checks, parsing arguments, and making the server call for creation. -func (c *cmdClusterGroupCreate) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGroupCreate) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -206,7 +206,7 @@ type cmdClusterGroupDelete struct { } // It deletes a cluster group, setting up usage, descriptions, aliases, and the RunE method. -func (c *cmdClusterGroupDelete) Command() *cobra.Command { +func (c *cmdClusterGroupDelete) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("delete", i18n.G("[:]")) cmd.Aliases = []string{"rm"} @@ -214,13 +214,13 @@ func (c *cmdClusterGroupDelete) Command() *cobra.Command { cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Delete a cluster group`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // It's the deletion of a cluster group after argument checks, parsing, and making the server call for deletion. -func (c *cmdClusterGroupDelete) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGroupDelete) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -259,20 +259,20 @@ type cmdClusterGroupEdit struct { } // This Command generates the cobra command that enables the editing of a cluster group's attributes. -func (c *cmdClusterGroupEdit) Command() *cobra.Command { +func (c *cmdClusterGroupEdit) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("edit", i18n.G("[:]")) cmd.Short = i18n.G("Edit a cluster group") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Edit a cluster group`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // The modification of a cluster group's configuration, either through an editor or via the terminal. -func (c *cmdClusterGroupEdit) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGroupEdit) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -374,7 +374,7 @@ type cmdClusterGroupList struct { } // Command returns a cobra command to list all the cluster groups in a specified format. -func (c *cmdClusterGroupList) Command() *cobra.Command { +func (c *cmdClusterGroupList) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("list", i18n.G("[:]")) cmd.Aliases = []string{"ls"} @@ -383,13 +383,13 @@ func (c *cmdClusterGroupList) Command() *cobra.Command { `List all the cluster groups`)) cmd.Flags().StringVarP(&c.flagFormat, "format", "f", "table", i18n.G("Format (csv|json|table|yaml|compact)")+"``") - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run executes the command to list all the cluster groups, their descriptions, and number of members. -func (c *cmdClusterGroupList) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGroupList) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 0, 1) if exit { @@ -449,20 +449,20 @@ type cmdClusterGroupRemove struct { } // Removal of a specified member from a specific cluster group. -func (c *cmdClusterGroupRemove) Command() *cobra.Command { +func (c *cmdClusterGroupRemove) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("remove", i18n.G("[:] ")) cmd.Short = i18n.G("Remove member from group") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Remove a cluster member from a cluster group`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // The removal process of a cluster member from a specific cluster group, with verbose output unless the 'quiet' flag is set. -func (c *cmdClusterGroupRemove) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGroupRemove) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { @@ -521,7 +521,7 @@ type cmdClusterGroupRename struct { } // Renaming a cluster group, defining usage, aliases, and linking the associated runtime function. -func (c *cmdClusterGroupRename) Command() *cobra.Command { +func (c *cmdClusterGroupRename) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("rename", i18n.G("[:] ")) cmd.Aliases = []string{"mv"} @@ -529,13 +529,13 @@ func (c *cmdClusterGroupRename) Command() *cobra.Command { cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Rename a cluster group`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Renaming operation of a cluster group after checking arguments and parsing the remote server, and provides appropriate output. -func (c *cmdClusterGroupRename) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGroupRename) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { @@ -570,20 +570,20 @@ type cmdClusterGroupShow struct { } // Setting up the 'show' command to display the configurations of a specified cluster group in a remote server. -func (c *cmdClusterGroupShow) Command() *cobra.Command { +func (c *cmdClusterGroupShow) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("show", i18n.G("[:]")) cmd.Short = i18n.G("Show cluster group configurations") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Show cluster group configurations`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // This retrieves and prints the configuration details of a specified cluster group from a remote server in YAML format. -func (c *cmdClusterGroupShow) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGroupShow) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -624,19 +624,19 @@ type cmdClusterGroupAdd struct { cluster *cmdCluster } -func (c *cmdClusterGroupAdd) Command() *cobra.Command { +func (c *cmdClusterGroupAdd) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("add", i18n.G("[:] ")) cmd.Short = i18n.G("Add member to group") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Add a cluster member to a cluster group`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdClusterGroupAdd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterGroupAdd) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { diff --git a/lxc/cluster_role.go b/lxc/cluster_role.go index 5c0762b88b41..499f96a0dc87 100644 --- a/lxc/cluster_role.go +++ b/lxc/cluster_role.go @@ -16,7 +16,7 @@ type cmdClusterRole struct { } // It uses the cmdGlobal, cmdCluster, and cmdClusterRole structs for context and operation. -func (c *cmdClusterRole) Command() *cobra.Command { +func (c *cmdClusterRole) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("role") cmd.Short = i18n.G("Manage cluster roles") @@ -24,11 +24,11 @@ func (c *cmdClusterRole) Command() *cobra.Command { // Add clusterRoleAddCmd := cmdClusterRoleAdd{global: c.global, cluster: c.cluster, clusterRole: c} - cmd.AddCommand(clusterRoleAddCmd.Command()) + cmd.AddCommand(clusterRoleAddCmd.command()) // Remove clusterRoleRemoveCmd := cmdClusterRoleRemove{global: c.global, cluster: c.cluster, clusterRole: c} - cmd.AddCommand(clusterRoleRemoveCmd.Command()) + cmd.AddCommand(clusterRoleRemoveCmd.command()) // Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706 cmd.Args = cobra.NoArgs @@ -43,20 +43,20 @@ type cmdClusterRoleAdd struct { } // Setting up the usage, short description, and long description of the command, as well as its RunE method. -func (c *cmdClusterRoleAdd) Command() *cobra.Command { +func (c *cmdClusterRoleAdd) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("add", i18n.G("[:] ")) cmd.Short = i18n.G("Add roles to a cluster member") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Add roles to a cluster member`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // It checks and parses input arguments, verifies role assignment, and updates the member's roles. -func (c *cmdClusterRoleAdd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterRoleAdd) run(cmd *cobra.Command, args []string) error { exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { return err @@ -99,20 +99,20 @@ type cmdClusterRoleRemove struct { } // Removing the roles from a cluster member, setting up usage, descriptions, and the RunE method. -func (c *cmdClusterRoleRemove) Command() *cobra.Command { +func (c *cmdClusterRoleRemove) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("remove", i18n.G("[:] ")) cmd.Short = i18n.G("Remove roles from a cluster member") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Remove roles from a cluster member`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run executes the removal of specified roles from a cluster member, checking inputs, validating role assignment, and updating the member's roles. -func (c *cmdClusterRoleRemove) Run(cmd *cobra.Command, args []string) error { +func (c *cmdClusterRoleRemove) run(cmd *cobra.Command, args []string) error { exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { return err diff --git a/lxc/config.go b/lxc/config.go index d0ad665a5e0a..9689dd9ca3d0 100644 --- a/lxc/config.go +++ b/lxc/config.go @@ -25,7 +25,7 @@ type cmdConfig struct { // Command creates a Cobra command for managing instance and server configurations, // including options for device, edit, get, metadata, profile, set, show, template, trust, and unset. -func (c *cmdConfig) Command() *cobra.Command { +func (c *cmdConfig) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("config") cmd.Short = i18n.G("Manage instance and server configuration options") @@ -34,50 +34,50 @@ func (c *cmdConfig) Command() *cobra.Command { // Device configDeviceCmd := cmdConfigDevice{global: c.global, config: c} - cmd.AddCommand(configDeviceCmd.Command()) + cmd.AddCommand(configDeviceCmd.command()) // Edit configEditCmd := cmdConfigEdit{global: c.global, config: c} - cmd.AddCommand(configEditCmd.Command()) + cmd.AddCommand(configEditCmd.command()) // Get configGetCmd := cmdConfigGet{global: c.global, config: c} - cmd.AddCommand(configGetCmd.Command()) + cmd.AddCommand(configGetCmd.command()) // Metadata configMetadataCmd := cmdConfigMetadata{global: c.global, config: c} - cmd.AddCommand(configMetadataCmd.Command()) + cmd.AddCommand(configMetadataCmd.command()) // Profile configProfileCmd := cmdProfile{global: c.global} - profileCmd := configProfileCmd.Command() + profileCmd := configProfileCmd.command() profileCmd.Hidden = true profileCmd.Deprecated = i18n.G("please use `lxc profile`") cmd.AddCommand(profileCmd) // Set configSetCmd := cmdConfigSet{global: c.global, config: c} - cmd.AddCommand(configSetCmd.Command()) + cmd.AddCommand(configSetCmd.command()) // Show configShowCmd := cmdConfigShow{global: c.global, config: c} - cmd.AddCommand(configShowCmd.Command()) + cmd.AddCommand(configShowCmd.command()) // Template configTemplateCmd := cmdConfigTemplate{global: c.global, config: c} - cmd.AddCommand(configTemplateCmd.Command()) + cmd.AddCommand(configTemplateCmd.command()) // Trust configTrustCmd := cmdConfigTrust{global: c.global, config: c} - cmd.AddCommand(configTrustCmd.Command()) + cmd.AddCommand(configTrustCmd.command()) // Unset configUnsetCmd := cmdConfigUnset{global: c.global, config: c, configSet: &configSetCmd} - cmd.AddCommand(configUnsetCmd.Command()) + cmd.AddCommand(configUnsetCmd.command()) // Uefi configUefiCmd := cmdConfigUefi{global: c.global, config: c} - cmd.AddCommand(configUefiCmd.Command()) + cmd.AddCommand(configUefiCmd.command()) // Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706 cmd.Args = cobra.NoArgs @@ -92,7 +92,7 @@ type cmdConfigEdit struct { } // Command creates a Cobra command to edit instance or server configurations using YAML, with optional flags for targeting cluster members. -func (c *cmdConfigEdit) Command() *cobra.Command { +func (c *cmdConfigEdit) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("edit", i18n.G("[:][[/]]")) cmd.Short = i18n.G("Edit instance or server configurations as YAML") @@ -103,7 +103,7 @@ func (c *cmdConfigEdit) Command() *cobra.Command { Update the instance configuration from config.yaml.`)) cmd.Flags().StringVar(&c.config.flagTarget, "target", "", i18n.G("Cluster member name")+"``") - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } @@ -131,7 +131,7 @@ func (c *cmdConfigEdit) helpTemplate() string { } // Run executes the config edit command, allowing users to edit instance or server configurations via an interactive YAML editor. -func (c *cmdConfigEdit) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigEdit) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 0, 1) if exit { @@ -377,7 +377,7 @@ type cmdConfigGet struct { // Command creates a Cobra command to fetch values for given instance or server configuration keys, // with optional flags for expanded configuration and cluster targeting. -func (c *cmdConfigGet) Command() *cobra.Command { +func (c *cmdConfigGet) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("get", i18n.G("[:][] ")) cmd.Short = i18n.G("Get values for instance or server configuration keys") @@ -387,13 +387,13 @@ func (c *cmdConfigGet) Command() *cobra.Command { cmd.Flags().BoolVarP(&c.flagExpanded, "expanded", "e", false, i18n.G("Access the expanded configuration")) cmd.Flags().BoolVarP(&c.flagIsProperty, "property", "p", false, i18n.G("Get the key as an instance property")) cmd.Flags().StringVar(&c.config.flagTarget, "target", "", i18n.G("Cluster member name")+"``") - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run fetches and prints the specified configuration key's value for an instance or server, also handling target and expansion flags. -func (c *cmdConfigGet) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigGet) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 2) if exit { @@ -510,7 +510,7 @@ type cmdConfigSet struct { } // Command creates a new Cobra command to set instance or server configuration keys and returns it. -func (c *cmdConfigSet) Command() *cobra.Command { +func (c *cmdConfigSet) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("set", i18n.G("[:][] =...")) cmd.Short = i18n.G("Set instance or server configuration keys") @@ -531,13 +531,13 @@ lxc config set core.trust_password=blah cmd.Flags().StringVar(&c.config.flagTarget, "target", "", i18n.G("Cluster member name")+"``") cmd.Flags().BoolVarP(&c.flagIsProperty, "property", "p", false, i18n.G("Set the key as an instance property")) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run executes the "set" command, updating instance or server configuration keys based on provided arguments. -func (c *cmdConfigSet) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigSet) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, -1) if exit { @@ -727,7 +727,7 @@ type cmdConfigShow struct { } // Command sets up the "show" command, which displays instance or server configurations based on the provided arguments. -func (c *cmdConfigShow) Command() *cobra.Command { +func (c *cmdConfigShow) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("show", i18n.G("[:][[/]]")) cmd.Short = i18n.G("Show instance or server configurations") @@ -736,13 +736,13 @@ func (c *cmdConfigShow) Command() *cobra.Command { cmd.Flags().BoolVarP(&c.flagExpanded, "expanded", "e", false, i18n.G("Show the expanded configuration")) cmd.Flags().StringVar(&c.config.flagTarget, "target", "", i18n.G("Cluster member name")+"``") - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run executes the "show" command, displaying the YAML-formatted configuration of a specified server or instance. -func (c *cmdConfigShow) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigShow) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 0, 1) if exit { @@ -851,7 +851,7 @@ type cmdConfigUnset struct { } // Command generates a new "unset" command to remove specific configuration keys for an instance or server. -func (c *cmdConfigUnset) Command() *cobra.Command { +func (c *cmdConfigUnset) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("unset", i18n.G("[:][] ")) cmd.Short = i18n.G("Unset instance or server configuration keys") @@ -860,13 +860,13 @@ func (c *cmdConfigUnset) Command() *cobra.Command { cmd.Flags().StringVar(&c.config.flagTarget, "target", "", i18n.G("Cluster member name")+"``") cmd.Flags().BoolVarP(&c.flagIsProperty, "property", "p", false, i18n.G("Unset the key as an instance property")) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run executes the "unset" command, delegating to the "set" command to remove specific configuration keys. -func (c *cmdConfigUnset) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigUnset) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 2) if exit { @@ -876,7 +876,7 @@ func (c *cmdConfigUnset) Run(cmd *cobra.Command, args []string) error { c.configSet.flagIsProperty = c.flagIsProperty args = append(args, "") - return c.configSet.Run(cmd, args) + return c.configSet.run(cmd, args) } type cmdConfigUefi struct { @@ -886,7 +886,7 @@ type cmdConfigUefi struct { // Command creates a Cobra command for managing virtual machine instance UEFI variables, // including options for get, set, unset, show, edit. -func (c *cmdConfigUefi) Command() *cobra.Command { +func (c *cmdConfigUefi) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("uefi") cmd.Short = i18n.G("Manage instance UEFI variables") @@ -895,23 +895,23 @@ func (c *cmdConfigUefi) Command() *cobra.Command { // Get configUefiGetCmd := cmdConfigUefiGet{global: c.global, configUefi: c} - cmd.AddCommand(configUefiGetCmd.Command()) + cmd.AddCommand(configUefiGetCmd.command()) // Set configUefiSetCmd := cmdConfigUefiSet{global: c.global, configUefi: c} - cmd.AddCommand(configUefiSetCmd.Command()) + cmd.AddCommand(configUefiSetCmd.command()) // Unset configUefiUnsetCmd := cmdConfigUefiUnset{global: c.global, configUefi: c, configSet: &configUefiSetCmd} - cmd.AddCommand(configUefiUnsetCmd.Command()) + cmd.AddCommand(configUefiUnsetCmd.command()) // Show configUefiShowCmd := cmdConfigUefiShow{global: c.global, configUefi: c} - cmd.AddCommand(configUefiShowCmd.Command()) + cmd.AddCommand(configUefiShowCmd.command()) // Edit configUefiEditCmd := cmdConfigUefiEdit{global: c.global, configUefi: c} - cmd.AddCommand(configUefiEditCmd.Command()) + cmd.AddCommand(configUefiEditCmd.command()) // Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706 cmd.Args = cobra.NoArgs @@ -926,20 +926,20 @@ type cmdConfigUefiGet struct { } // Command creates a Cobra command to fetch virtual machine instance UEFI variables. -func (c *cmdConfigUefiGet) Command() *cobra.Command { +func (c *cmdConfigUefiGet) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("get", i18n.G("[:] ")) cmd.Short = i18n.G("Get UEFI variables for instance") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Get UEFI variables for instance`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run fetches and prints the specified UEFI variable's value. -func (c *cmdConfigUefiGet) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigUefiGet) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { @@ -981,7 +981,7 @@ type cmdConfigUefiSet struct { } // Command creates a new Cobra command to set virtual machine instance UEFI variables. -func (c *cmdConfigUefiSet) Command() *cobra.Command { +func (c *cmdConfigUefiSet) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("set", i18n.G("[:] =...")) cmd.Short = i18n.G("Set UEFI variables for instance") @@ -991,13 +991,13 @@ func (c *cmdConfigUefiSet) Command() *cobra.Command { `lxc config uefi set [:] testvar-9073e4e0-60ec-4b6e-9903-4c223c260f3c=aabb Set a UEFI variable with name "testvar", GUID 9073e4e0-60ec-4b6e-9903-4c223c260f3c and value "aabb" (HEX-encoded) for the instance.`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run executes the "set" command, updating virtual machine instance UEFI variables based on provided arguments. -func (c *cmdConfigUefiSet) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigUefiSet) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, -1) if exit { @@ -1072,20 +1072,20 @@ type cmdConfigUefiUnset struct { } // Command generates a new "unset" command to remove specific virtual machine instance UEFI variable. -func (c *cmdConfigUefiUnset) Command() *cobra.Command { +func (c *cmdConfigUefiUnset) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("unset", i18n.G("[:] ")) cmd.Short = i18n.G("Unset UEFI variables for instance") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Unset UEFI variables for instance`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run executes the "unset" command, delegating to the "set" command to remove specific UEFI variable. -func (c *cmdConfigUefiUnset) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigUefiUnset) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, 2) if exit { @@ -1093,7 +1093,7 @@ func (c *cmdConfigUefiUnset) Run(cmd *cobra.Command, args []string) error { } args = append(args, "") - return c.configSet.Run(cmd, args) + return c.configSet.run(cmd, args) } // Show. @@ -1103,20 +1103,20 @@ type cmdConfigUefiShow struct { } // Command sets up the "show" command, which displays virtual machine instance UEFI variables based on the provided arguments. -func (c *cmdConfigUefiShow) Command() *cobra.Command { +func (c *cmdConfigUefiShow) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("show", i18n.G("[:]")) cmd.Short = i18n.G("Show instance UEFI variables") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Show instance UEFI variables`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } // Run executes the "show" command, displaying the YAML-formatted configuration of a virtual machine instance UEFI variables. -func (c *cmdConfigUefiShow) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigUefiShow) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -1157,7 +1157,7 @@ type cmdConfigUefiEdit struct { } // Command creates a Cobra command to edit virtual machine instance UEFI variables. -func (c *cmdConfigUefiEdit) Command() *cobra.Command { +func (c *cmdConfigUefiEdit) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("edit", i18n.G("[:]")) cmd.Short = i18n.G("Edit instance UEFI variables") @@ -1167,7 +1167,7 @@ func (c *cmdConfigUefiEdit) Command() *cobra.Command { `lxc config uefi edit < instance_uefi_vars.yaml Set the instance UEFI variables from instance_uefi_vars.yaml.`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } @@ -1208,7 +1208,7 @@ func (c *cmdConfigUefiEdit) helpTemplate() string { } // Run executes the config edit command, allowing users to edit virtual machine instance UEFI variables via an interactive YAML editor. -func (c *cmdConfigUefiEdit) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigUefiEdit) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { diff --git a/lxc/config_device.go b/lxc/config_device.go index 99f7123ef4b6..f9314af68998 100644 --- a/lxc/config_device.go +++ b/lxc/config_device.go @@ -17,7 +17,7 @@ type cmdConfigDevice struct { profile *cmdProfile } -func (c *cmdConfigDevice) Command() *cobra.Command { +func (c *cmdConfigDevice) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("device") cmd.Short = i18n.G("Manage devices") @@ -26,37 +26,37 @@ func (c *cmdConfigDevice) Command() *cobra.Command { // Add configDeviceAddCmd := cmdConfigDeviceAdd{global: c.global, config: c.config, profile: c.profile, configDevice: c} - cmd.AddCommand(configDeviceAddCmd.Command()) + cmd.AddCommand(configDeviceAddCmd.command()) // Get configDeviceGetCmd := cmdConfigDeviceGet{global: c.global, config: c.config, profile: c.profile, configDevice: c} - cmd.AddCommand(configDeviceGetCmd.Command()) + cmd.AddCommand(configDeviceGetCmd.command()) // List configDeviceListCmd := cmdConfigDeviceList{global: c.global, config: c.config, profile: c.profile, configDevice: c} - cmd.AddCommand(configDeviceListCmd.Command()) + cmd.AddCommand(configDeviceListCmd.command()) // Override if c.config != nil { configDeviceOverrideCmd := cmdConfigDeviceOverride{global: c.global, config: c.config, profile: c.profile, configDevice: c} - cmd.AddCommand(configDeviceOverrideCmd.Command()) + cmd.AddCommand(configDeviceOverrideCmd.command()) } // Remove configDeviceRemoveCmd := cmdConfigDeviceRemove{global: c.global, config: c.config, profile: c.profile, configDevice: c} - cmd.AddCommand(configDeviceRemoveCmd.Command()) + cmd.AddCommand(configDeviceRemoveCmd.command()) // Set configDeviceSetCmd := cmdConfigDeviceSet{global: c.global, config: c.config, profile: c.profile, configDevice: c} - cmd.AddCommand(configDeviceSetCmd.Command()) + cmd.AddCommand(configDeviceSetCmd.command()) // Show configDeviceShowCmd := cmdConfigDeviceShow{global: c.global, config: c.config, profile: c.profile, configDevice: c} - cmd.AddCommand(configDeviceShowCmd.Command()) + cmd.AddCommand(configDeviceShowCmd.command()) // Unset configDeviceUnsetCmd := cmdConfigDeviceUnset{global: c.global, config: c.config, profile: c.profile, configDevice: c, configDeviceSet: &configDeviceSetCmd} - cmd.AddCommand(configDeviceUnsetCmd.Command()) + cmd.AddCommand(configDeviceUnsetCmd.command()) // Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706 cmd.Args = cobra.NoArgs @@ -72,7 +72,7 @@ type cmdConfigDeviceAdd struct { profile *cmdProfile } -func (c *cmdConfigDeviceAdd) Command() *cobra.Command { +func (c *cmdConfigDeviceAdd) command() *cobra.Command { cmd := &cobra.Command{} cmd.Short = i18n.G("Add instance devices") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( @@ -95,12 +95,12 @@ lxc profile device add [:]profile1 disk pool=some-pool sou Will mount the some-volume volume on some-pool onto /opt in the instance.`)) } - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdConfigDeviceAdd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigDeviceAdd) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 3, -1) if exit { @@ -196,7 +196,7 @@ type cmdConfigDeviceGet struct { profile *cmdProfile } -func (c *cmdConfigDeviceGet) Command() *cobra.Command { +func (c *cmdConfigDeviceGet) command() *cobra.Command { cmd := &cobra.Command{} if c.config != nil { cmd.Use = usage("get", i18n.G("[:] ")) @@ -208,12 +208,12 @@ func (c *cmdConfigDeviceGet) Command() *cobra.Command { cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Get values for device configuration keys`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdConfigDeviceGet) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigDeviceGet) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 3, 3) if exit { @@ -278,7 +278,7 @@ type cmdConfigDeviceList struct { profile *cmdProfile } -func (c *cmdConfigDeviceList) Command() *cobra.Command { +func (c *cmdConfigDeviceList) command() *cobra.Command { cmd := &cobra.Command{} cmd.Aliases = []string{"ls"} cmd.Short = i18n.G("List instance devices") @@ -290,12 +290,12 @@ func (c *cmdConfigDeviceList) Command() *cobra.Command { cmd.Use = usage("list", i18n.G("[:]")) } - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdConfigDeviceList) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigDeviceList) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -349,19 +349,19 @@ type cmdConfigDeviceOverride struct { profile *cmdProfile } -func (c *cmdConfigDeviceOverride) Command() *cobra.Command { +func (c *cmdConfigDeviceOverride) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("override", i18n.G("[:] [key=value...]")) cmd.Short = i18n.G("Copy profile inherited devices and override configuration keys") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Copy profile inherited devices and override configuration keys`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdConfigDeviceOverride) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigDeviceOverride) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, -1) if exit { @@ -437,7 +437,7 @@ type cmdConfigDeviceRemove struct { profile *cmdProfile } -func (c *cmdConfigDeviceRemove) Command() *cobra.Command { +func (c *cmdConfigDeviceRemove) command() *cobra.Command { cmd := &cobra.Command{} if c.config != nil { cmd.Use = usage("remove", i18n.G("[:] ...")) @@ -450,12 +450,12 @@ func (c *cmdConfigDeviceRemove) Command() *cobra.Command { cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Remove instance devices`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdConfigDeviceRemove) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigDeviceRemove) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 2, -1) if exit { @@ -540,7 +540,7 @@ type cmdConfigDeviceSet struct { profile *cmdProfile } -func (c *cmdConfigDeviceSet) Command() *cobra.Command { +func (c *cmdConfigDeviceSet) command() *cobra.Command { cmd := &cobra.Command{} cmd.Short = i18n.G("Set device configuration keys") if c.config != nil { @@ -559,12 +559,12 @@ For backward compatibility, a single configuration key may still be set with: lxc profile device set [:] `)) } - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdConfigDeviceSet) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigDeviceSet) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 3, -1) if exit { @@ -656,7 +656,7 @@ type cmdConfigDeviceShow struct { profile *cmdProfile } -func (c *cmdConfigDeviceShow) Command() *cobra.Command { +func (c *cmdConfigDeviceShow) command() *cobra.Command { cmd := &cobra.Command{} if c.config != nil { cmd.Use = usage("show", i18n.G("[:]")) @@ -668,12 +668,12 @@ func (c *cmdConfigDeviceShow) Command() *cobra.Command { cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Show full device configuration`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdConfigDeviceShow) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigDeviceShow) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -729,7 +729,7 @@ type cmdConfigDeviceUnset struct { profile *cmdProfile } -func (c *cmdConfigDeviceUnset) Command() *cobra.Command { +func (c *cmdConfigDeviceUnset) command() *cobra.Command { cmd := &cobra.Command{} if c.config != nil { cmd.Use = usage("unset", i18n.G("[:] ")) @@ -741,12 +741,12 @@ func (c *cmdConfigDeviceUnset) Command() *cobra.Command { cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Unset device configuration keys`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdConfigDeviceUnset) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigDeviceUnset) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 3, 3) if exit { @@ -754,5 +754,5 @@ func (c *cmdConfigDeviceUnset) Run(cmd *cobra.Command, args []string) error { } args = append(args, "") - return c.configDeviceSet.Run(cmd, args) + return c.configDeviceSet.run(cmd, args) } diff --git a/lxc/config_metadata.go b/lxc/config_metadata.go index 5a5750cc250d..17b3de585d7e 100644 --- a/lxc/config_metadata.go +++ b/lxc/config_metadata.go @@ -20,7 +20,7 @@ type cmdConfigMetadata struct { config *cmdConfig } -func (c *cmdConfigMetadata) Command() *cobra.Command { +func (c *cmdConfigMetadata) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("metadata") cmd.Short = i18n.G("Manage instance metadata files") @@ -29,11 +29,11 @@ func (c *cmdConfigMetadata) Command() *cobra.Command { // Edit configMetadataEditCmd := cmdConfigMetadataEdit{global: c.global, config: c.config, configMetadata: c} - cmd.AddCommand(configMetadataEditCmd.Command()) + cmd.AddCommand(configMetadataEditCmd.command()) // Show configMetadataShowCmd := cmdConfigMetadataShow{global: c.global, config: c.config, configMetadata: c} - cmd.AddCommand(configMetadataShowCmd.Command()) + cmd.AddCommand(configMetadataShowCmd.command()) // Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706 cmd.Args = cobra.NoArgs @@ -48,14 +48,14 @@ type cmdConfigMetadataEdit struct { configMetadata *cmdConfigMetadata } -func (c *cmdConfigMetadataEdit) Command() *cobra.Command { +func (c *cmdConfigMetadataEdit) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("edit", i18n.G("[:]")) cmd.Short = i18n.G("Edit instance metadata files") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Edit instance metadata files`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } @@ -84,7 +84,7 @@ func (c *cmdConfigMetadataEdit) helpTemplate() string { ### properties: {}`) } -func (c *cmdConfigMetadataEdit) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigMetadataEdit) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { @@ -173,19 +173,19 @@ type cmdConfigMetadataShow struct { configMetadata *cmdConfigMetadata } -func (c *cmdConfigMetadataShow) Command() *cobra.Command { +func (c *cmdConfigMetadataShow) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("show", i18n.G("[:]")) cmd.Short = i18n.G("Show instance metadata files") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( `Show instance metadata files`)) - cmd.RunE = c.Run + cmd.RunE = c.run return cmd } -func (c *cmdConfigMetadataShow) Run(cmd *cobra.Command, args []string) error { +func (c *cmdConfigMetadataShow) run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 1, 1) if exit { diff --git a/lxc/config_template.go b/lxc/config_template.go index 3c50e0b6e331..f3bbf80a7fed 100644 --- a/lxc/config_template.go +++ b/lxc/config_template.go @@ -20,7 +20,7 @@ type cmdConfigTemplate struct { config *cmdConfig } -func (c *cmdConfigTemplate) Command() *cobra.Command { +func (c *cmdConfigTemplate) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("template") cmd.Short = i18n.G("Manage instance file templates") @@ -29,23 +29,23 @@ func (c *cmdConfigTemplate) Command() *cobra.Command { // Create configTemplateCreateCmd := cmdConfigTemplateCreate{global: c.global, config: c.config, configTemplate: c} - cmd.AddCommand(configTemplateCreateCmd.Command()) + cmd.AddCommand(configTemplateCreateCmd.command()) // Delete configTemplateDeleteCmd := cmdConfigTemplateDelete{global: c.global, config: c.config, configTemplate: c} - cmd.AddCommand(configTemplateDeleteCmd.Command()) + cmd.AddCommand(configTemplateDeleteCmd.command()) // Edit configTemplateEditCmd := cmdConfigTemplateEdit{global: c.global, config: c.config, configTemplate: c} - cmd.AddCommand(configTemplateEditCmd.Command()) + cmd.AddCommand(configTemplateEditCmd.command()) // List configTemplateListCmd := cmdConfigTemplateList{global: c.global, config: c.config, configTemplate: c} - cmd.AddCommand(configTemplateListCmd.Command()) + cmd.AddCommand(configTemplateListCmd.command()) // Show configTemplateShowCmd := cmdConfigTemplateShow{global: c.global, config: c.config, configTemplate: c} - cmd.AddCommand(configTemplateShowCmd.Command()) + cmd.AddCommand(configTemplateShowCmd.command()) // Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706 cmd.Args = cobra.NoArgs @@ -60,19 +60,19 @@ type cmdConfigTemplateCreate struct { configTemplate *cmdConfigTemplate } -func (c *cmdConfigTemplateCreate) Command() *cobra.Command { +func (c *cmdConfigTemplateCreate) command() *cobra.Command { cmd := &cobra.Command{} cmd.Use = usage("create", i18n.G("[:]