func cmdUpdate(published bool, required bool) { vv := flag.Arg(1) if vv == "" { fmt.Printf("usage: version [-publish] [-require] update 20150906195708\n") os.Exit(1) } if required && !published { fmt.Printf("error: can not use `-require` without `-publish`\n") os.Exit(1) } v := version.Version{ Version: vv, Published: published, Required: required, } v, err := version.UpdateVersion(v) if err != nil { fmt.Printf("error: %v\n", err.Error()) os.Exit(1) } fmt.Println(v.Display()) }
func cmdCreate(published bool, required bool) { vv := flag.Arg(1) if vv == "" { fmt.Printf("usage: version [-publish] [-require] create 20150906195708\n") os.Exit(1) } v := version.Version{ Version: vv, Published: published, Required: required, } v, err := version.AppendVersion(v) if err != nil { fmt.Printf("error: %v\n", err.Error()) os.Exit(1) } fmt.Println(v.Display()) }