46 lines
726 B
Go
Raw Normal View History

package main
import (
"errors"
"flag"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn/stringutils"
"github.com/animenotifier/kitsu"
)
// Shell parameters
var animeID string
var verbose bool
// Shell flags
func init() {
flag.StringVar(&animeID, "id", "", "ID of the anime that you want to refresh")
flag.BoolVar(&verbose, "v", false, "Verbose output")
flag.Parse()
}
// InvokeShellArgs ...
func InvokeShellArgs() bool {
if animeID != "" {
kitsuAnime, err := kitsu.GetAnime(animeID)
if err != nil {
panic(err)
}
if kitsuAnime.ID != animeID {
panic(errors.New("Anime ID is not the same"))
}
2018-03-17 00:24:06 +00:00
sync(kitsuAnime)
if verbose {
2018-04-19 20:15:05 +00:00
stringutils.PrettyPrint(kitsuAnime)
}
return true
}
return false
}