Rename variables

This commit is contained in:
Tim Van Baak 2025-03-06 17:14:08 -08:00
parent a0c7d620ad
commit f6e51a992c

View File

@ -9,7 +9,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var itemDeactivateCmd = &cobra.Command{ var deactivateCmd = &cobra.Command{
Use: "deactivate --source source [--item item]", Use: "deactivate --source source [--item item]",
Aliases: []string{"deac"}, Aliases: []string{"deac"},
Short: "Deactivate items", Short: "Deactivate items",
@ -17,20 +17,20 @@ var itemDeactivateCmd = &cobra.Command{
Deactivation is idempotent.`, Deactivation is idempotent.`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
itemDeactivate(stringArg(cmd, "source"), stringArg(cmd, "item")) deactivate(stringArg(cmd, "source"), stringArg(cmd, "item"))
}, },
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
} }
func init() { func init() {
rootCmd.AddCommand(itemDeactivateCmd) rootCmd.AddCommand(deactivateCmd)
itemDeactivateCmd.Flags().StringP("source", "s", "", "Source of the item") deactivateCmd.Flags().StringP("source", "s", "", "Source of the item")
itemDeactivateCmd.MarkFlagRequired("source") deactivateCmd.MarkFlagRequired("source")
itemDeactivateCmd.Flags().StringP("item", "i", "", "Item id") deactivateCmd.Flags().StringP("item", "i", "", "Item id")
} }
func itemDeactivate(source string, item string) { func deactivate(source string, item string) {
if source == "" { if source == "" {
log.Fatal("error: --source is empty") log.Fatal("error: --source is empty")
} }