2017-10-04 06:12:12 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-10-06 10:44:55 +00:00
|
|
|
"flag"
|
2017-10-04 06:12:12 +00:00
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/animenotifier/arn"
|
2019-03-30 06:39:40 +00:00
|
|
|
"github.com/blitzprog/color"
|
2017-10-04 06:12:12 +00:00
|
|
|
)
|
|
|
|
|
2017-10-06 10:44:55 +00:00
|
|
|
// Shell parameters
|
|
|
|
var confirmed bool
|
|
|
|
|
|
|
|
// Shell flags
|
|
|
|
func init() {
|
|
|
|
flag.BoolVar(&confirmed, "confirm", false, "Confirm that you really want to execute this.")
|
|
|
|
flag.Parse()
|
|
|
|
}
|
|
|
|
|
2017-10-04 06:12:12 +00:00
|
|
|
func main() {
|
2017-10-06 10:44:55 +00:00
|
|
|
if !confirmed {
|
|
|
|
color.Green("Please run this command with -confirm option.")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
color.Yellow("Resetting all inventories")
|
2017-11-01 19:11:05 +00:00
|
|
|
defer arn.Node.Close()
|
2017-10-04 06:12:12 +00:00
|
|
|
|
|
|
|
// Iterate over the stream
|
2017-11-01 19:11:05 +00:00
|
|
|
for user := range arn.StreamUsers() {
|
2017-10-04 06:12:12 +00:00
|
|
|
fmt.Println(user.Nick)
|
|
|
|
|
|
|
|
inventory := arn.NewInventory(user.ID)
|
2017-11-01 19:11:05 +00:00
|
|
|
inventory.Save()
|
2017-10-04 06:12:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
color.Green("Finished.")
|
|
|
|
}
|