mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-27 04:11:03 +00:00
refactor get default build logs.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
f0cbe62d81
commit
3fdd466d7c
1 changed files with 3 additions and 3 deletions
|
@ -34,7 +34,7 @@ func buildLogs(c *cli.Context) error {
|
||||||
|
|
||||||
buildArg := c.Args().Get(1)
|
buildArg := c.Args().Get(1)
|
||||||
var number int
|
var number int
|
||||||
if buildArg == "last" {
|
if buildArg == "" {
|
||||||
// Fetch the build number from the last build
|
// Fetch the build number from the last build
|
||||||
build, err := client.BuildLast(owner, name, "")
|
build, err := client.BuildLast(owner, name, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -44,7 +44,7 @@ func buildLogs(c *cli.Context) error {
|
||||||
} else {
|
} else {
|
||||||
number, err = strconv.Atoi(buildArg)
|
number, err = strconv.Atoi(buildArg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("Error: Invalid number or missing job number. eg 100")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ func buildLogs(c *cli.Context) error {
|
||||||
if err = dec.Decode(&line); err != nil {
|
if err = dec.Decode(&line); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("%s\n", line.Out)
|
fmt.Printf("%s", line.Out)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = dec.Token()
|
_, err = dec.Token()
|
||||||
|
|
Loading…
Reference in a new issue