2018-03-17 01:36:36 +01:00

46 lines
695 B
Go

package main
import (
"errors"
"flag"
"github.com/animenotifier/arn"
"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"))
}
sync(kitsuAnime)
if verbose {
arn.PrettyPrint(kitsuAnime)
}
return true
}
return false
}