-
Notifications
You must be signed in to change notification settings - Fork 0
/
birdcounts.go
36 lines (31 loc) · 1.02 KB
/
birdcounts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
Copyright © 2023 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/waisbrot/birdweather_daily_email/birdweather"
)
// birdcountsCmd represents the birdcounts command
var birdcountsCmd = &cobra.Command{
Use: "birdcounts",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
stationIds := viper.GetIntSlice("stations")
fmt.Printf("stationIds=%#v\nconfig=%#v\nfile=%#v\n", stationIds, viper.AllSettings(), viper.ConfigFileUsed())
_, counts := birdweather.BirdsForStation(fmt.Sprint(stationIds[0]))
for i, count := range counts {
fmt.Printf("%d: %#v\n", i, count)
}
},
}
func init() {
rootCmd.AddCommand(birdcountsCmd)
}