From 2f4496972fb6a4750276ecf735bf6983ecc244ee Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 26 Oct 2023 19:04:52 +0200 Subject: [PATCH] Add sponsor command for testing tokens --- cmd/sponsor.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cmd/sponsor.go diff --git a/cmd/sponsor.go b/cmd/sponsor.go new file mode 100644 index 000000000..80b92a851 --- /dev/null +++ b/cmd/sponsor.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "github.com/evcc-io/evcc/util/sponsor" + "github.com/spf13/cobra" +) + +// sponsorCmd represents the vehicle command +var sponsorCmd = &cobra.Command{ + Use: "sponsor [name]", + Short: "Validate sponsor token", + Args: cobra.ExactArgs(1), + Run: runSponsor, +} + +func init() { + rootCmd.AddCommand(sponsorCmd) +} + +func runSponsor(cmd *cobra.Command, args []string) { + token := args[0] + + if err := sponsor.ConfigureSponsorship(token); err != nil { + fatal(err) + } + + log.INFO.Println("sponsorship validated") +}