Merge pull request #1957 from vtolstov/last
add last keyword for specify build number in build info
This commit is contained in:
commit
87276ebf7a
1 changed files with 16 additions and 4 deletions
|
@ -32,16 +32,28 @@ func buildInfo(c *cli.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
number, err := strconv.Atoi(c.Args().Get(1))
|
buildArg := c.Args().Get(1)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := newClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var number int
|
||||||
|
if buildArg == "last" {
|
||||||
|
// Fetch the build number from the last build
|
||||||
|
build, err := client.BuildLast(owner, name, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
number = build.Number
|
||||||
|
} else {
|
||||||
|
number, err = strconv.Atoi(buildArg)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
build, err := client.Build(owner, name, number)
|
build, err := client.Build(owner, name, number)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue