Add sponsor command for testing tokens
This commit is contained in:
parent
e22608a43a
commit
2f4496972f
1 changed files with 28 additions and 0 deletions
28
cmd/sponsor.go
Normal file
28
cmd/sponsor.go
Normal file
|
|
@ -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")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue