Browse Source

allow choosing which "phase" to run.

Lucas Stadler 11 years ago
parent
commit
2922be5f82
1 changed files with 3 additions and 2 deletions
  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
	}