Changing default values for CLI to allow season=0

This commit is contained in:
Andreas Mieke 2016-02-28 16:31:27 +01:00
parent 5deb41b6f1
commit f5d3efc1f3

View file

@ -27,32 +27,32 @@ var oldslug string
var newseason int64 var newseason int64
func InitCli() { func InitCli() {
flag.StringVar(&mode, "mode", "", "Specifies the action to be done. Can be add_lt and merge_lps") flag.StringVar(&mode, "mode", "null", "Specifies the action to be done. Can be add_lt and merge_lps")
// For add_lt // For add_lt
flag.StringVar(&slug, "slug", "", "Slug as it would be on gronkh.de") flag.StringVar(&slug, "slug", "null", "Slug as it would be on gronkh.de")
flag.StringVar(&name, "name", "", "Name as it would be on gronkh.de") flag.StringVar(&name, "name", "null", "Name as it would be on gronkh.de")
flag.StringVar(&aslug, "author", "", "Author slug") flag.StringVar(&aslug, "author", "null", "Author slug")
flag.StringVar(&youtubeid, "youtube", "", "YouTube ID of the video") flag.StringVar(&youtubeid, "youtube", "null", "YouTube ID of the video")
flag.StringVar(&poster, "poster", "", "Poster URL that should be used") flag.StringVar(&poster, "poster", "null", "Poster URL that should be used")
// For merge_lps // For merge_lps
flag.StringVar(&newslug, "newslug", "", "Slug of the final LP") flag.StringVar(&newslug, "newslug", "null", "Slug of the final LP")
flag.StringVar(&oldslug, "oldslug", "", "Current slug of LP to be merged") flag.StringVar(&oldslug, "oldslug", "null", "Current slug of LP to be merged")
flag.Int64Var(&newseason, "newseason", 0, "Season the episodes of the old LP will become") flag.Int64Var(&newseason, "newseason", -1, "Season the episodes of the old LP will become")
} }
func DoCli() { func DoCli() {
flag.Parse() flag.Parse()
if mode != "" { if mode != "null" {
if mode == "add_lt" { if mode == "add_lt" {
if (slug == "" || name == "" || aslug == "" || youtubeid == "" || poster == "") { if (slug == "null" || name == "null" || aslug == "null" || youtubeid == "null" || poster == "null") {
log.Fatalf("slug, name, author, youtube, poster must be specified") log.Fatalf("slug, name, author, youtube, poster must be specified")
} }
ParseCliLT() ParseCliLT()
} else if mode == "merge_lps" { } else if mode == "merge_lps" {
if (oldslug == "" || newslug == "" || newseason == 0) { if (oldslug == "null" || newslug == "null" || newseason == -1) {
log.Fatalf("oldslug, newslug, newseason must be specified") log.Fatalf("oldslug, newslug, newseason must be specified")
} }
MergeLPs() MergeLPs()