Exemple #1
0
func enableCmd(cmd *cli.Cmd) {
	params := map[string]string{
		"repository.slug": config.RepoSlug(),
	}

	res, err := client.Travis().PerformAction("repository", "enable", params)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	io.Copy(cmd.Stdout, res.Body)
}
Exemple #2
0
func buildsCmd(cmd *cli.Cmd) {
	params := map[string]string{
		"repository.slug":  config.RepoSlug(),
		"build.event_type": "push",
		"limit":            "10",
	}

	res, err := client.Travis().PerformAction("builds", "find", params)
	if err != nil {
		panic(err)
	}
	if res.StatusCode > 299 {
		cmd.Stderr.Printf("unexpected HTTP status: %d\n", res.StatusCode)
		cmd.Exit(1)
	}

	builds := Builds{}
	res.Unmarshal(&builds)

	for _, build := range builds.Builds {
		cmd.Stdout.Printf("#%s: %s (%s)\n", build.Number, build.State, build.Branch.Name)
	}
}