add last keyword for secify build number in build info

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
Vasiliy Tolstov 2017-03-08 16:14:16 +03:00
parent d7758a23e0
commit 9ff44ce7f7

View file

@ -32,16 +32,28 @@ func buildInfo(c *cli.Context) error {
if err != nil {
return err
}
number, err := strconv.Atoi(c.Args().Get(1))
if err != nil {
return err
}
buildArg := c.Args().Get(1)
client, err := newClient(c)
if err != nil {
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)
if err != nil {
return err