func releases(cmd *c.Command, args []string) {
	dev.MustFindCrowbar()
	res := make([]string, 0, 20)
	for release := range dev.Releases() {
		res = append(res, release)
	}
	sort.Strings(res)
	for _, release := range res {
		fmt.Println(release)
	}
}
func switchBuild(cmd *c.Command, args []string) {
	dev.MustFindCrowbar()
	if ok, _ := dev.IsClean(); !ok {
		log.Fatalln("Crowbar is not clean, cannot switch builds.")
	}
	rels := dev.Releases()
	current := dev.CurrentBuild()
	var target dev.Build
	found := false
	switch len(args) {
	case 0:
		target, found = current, true
	case 1:
		// Were we passed a known release?
		rel, foundRel := rels[args[0]]
		if foundRel {
			for _, build := range []string{current.Name(), "master"} {
				target, found = rel.Builds()[build]
				if found {
					break
				}
			}
		} else {
			target, found = dev.Builds()[args[0]]
		}
	default:
		log.Fatalf("switch takes 0 or 1 argument.")
	}
	if !found {
		log.Fatalf("%s is not anything we can switch to!")
	}
	ok, tokens := dev.Switch(target)
	for _, tok := range tokens {
		if tok.Results != nil {
			log.Printf("%s: %v\n", tok.Name, tok.Results)
		}
	}
	if ok {
		log.Printf("Switched to %s\n", target.FullName())
		os.Exit(0)
	}
	log.Printf("Failed to switch to %s!\n", target.FullName())
	ok, _ = dev.Switch(current)
	os.Exit(1)
}
func removeRelease(cmd *c.Command, args []string) {
	if len(args) != 1 {
		log.Fatalf("remove-release only accepts one argument!")
	}
	dev.MustFindCrowbar()
	releaseName := args[0]
	releases := dev.Releases()
	release, found := releases[releaseName]
	if !found {
		log.Fatalf("%s is not a release!\n", releaseName)
	}
	if releaseName == "development" {
		log.Fatal("Cannot delete the development release.")
	}
	if err := dev.RemoveRelease(release); err != nil {
		log.Fatal(err)
	}
	log.Printf("Release %s deleted.\n", releaseName)
}