46 lines
715 B
Go
Raw Normal View History

package main
import (
"errors"
"flag"
2018-04-19 20:15:05 +00:00
"github.com/animenotifier/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
}