gopherss/cmd/refresh.go

27 lines
555 B
Go
Raw Normal View History

2020-10-17 13:30:30 +00:00
package cmd
import (
"github.com/averagemarcus/gopherss/internal/feeds"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var refreshCmd = &cobra.Command{
Use: "refresh",
Short: "Refreshes all feeds",
RunE: func(cmd *cobra.Command, args []string) error {
return feeds.Refresh()
},
}
var (
interval int
)
func init() {
refreshCmd.Flags().IntVar(&interval, "interval", 15, "How long in minutes to wait before refreshing feeds")
2020-10-17 19:55:05 +00:00
viper.BindPFlag("REFRESH_TIMEOUT", refreshCmd.Flags().Lookup("interval"))
2020-10-17 13:30:30 +00:00
rootCmd.AddCommand(refreshCmd)
}