1
0
mirror of https://github.com/drone/drone-cli.git synced 2026-01-18 17:01:34 +01:00

Add --format to build restart

This commit is contained in:
Dominik Schmidt 2019-02-24 22:11:32 +01:00
parent fabeee952e
commit b9122ddb21

@ -3,7 +3,9 @@ package build
import (
"errors"
"fmt"
"os"
"strconv"
"text/template"
"github.com/drone/drone-cli/drone/internal"
"github.com/urfave/cli"
@ -19,6 +21,11 @@ var buildStartCmd = cli.Command{
Name: "param, p",
Usage: "custom parameters to be injected into the job environment. Format: KEY=value",
},
cli.StringFlag{
Name: "format",
Usage: "format output",
Value: "",
},
},
}
@ -60,6 +67,14 @@ func buildStart(c *cli.Context) (err error) {
return err
}
if c.IsSet("format") {
tmpl, err := template.New("_").Parse(c.String("format"))
if err != nil {
return err
}
return tmpl.Execute(os.Stdout, build)
}
fmt.Printf("Starting build %s/%s#%d\n", owner, name, build.Number)
return nil
}