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