Просмотр исходного кода

allow choosing which "phase" to run.

Lucas Stadler лет назад: 11
Родитель
Сommit
2922be5f82
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      go/qst.go

+ 3 - 2
go/qst.go

33
var autoRestart = flag.Bool("autorestart", true, "automatically restart after command exists")
33
var autoRestart = flag.Bool("autorestart", true, "automatically restart after command exists")
34
var command = flag.String("command", "", "command to run ({file} will be substituted)")
34
var command = flag.String("command", "", "command to run ({file} will be substituted)")
35
var projectType = flag.String("type", "", "project type to use (autodetected if not present)")
35
var projectType = flag.String("type", "", "project type to use (autodetected if not present)")
36
var phase = flag.String("phase", "run", "which phase to run (build, run or test)")
36
37
37
func main() {
38
func main() {
38
	log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
39
	log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
73
			log.Fatal("error: ", err)
74
			log.Fatal("error: ", err)
74
		}
75
		}
75
		log.Printf("detected a %s project", project.Id)
76
		log.Printf("detected a %s project", project.Id)
76
		projectCmd, found := project.Commands["run"]
77
		projectCmd, found := project.Commands[*phase]
77
		if !found {
78
		if !found {
78
			log.Fatalf("%s doesn't support `run'", project.Id)
79
			log.Fatalf("%s doesn't support `%s'", project.Id, *phase)
79
		}
80
		}
80
		cmd = projectCmd
81
		cmd = projectCmd
81
	}
82
	}