1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-04 03:11:55 +02:00

style: improved goreleaser output

- Added paddings
- Added total time taken by the release

Closes #441
This commit is contained in:
Carlos Alexandro Becker 2017-12-06 01:02:52 -02:00 committed by Carlos Alexandro Becker
parent 5a199e50d2
commit 29d9ae5878
3 changed files with 12 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import (
"strings"
"github.com/apex/log"
"github.com/apex/log/handlers/cli"
"github.com/goreleaser/goreleaser/config"
"github.com/goreleaser/goreleaser/context"
"github.com/goreleaser/goreleaser/pipeline"
@ -88,13 +89,17 @@ func Release(flags Flags) error {
ctx.Publish = false
}
ctx.RmDist = flags.Bool("rm-dist")
logger, _ := log.Log.(*log.Logger)
handler, _ := logger.Handler.(*cli.Handler)
for _, pipe := range pipes {
handler.Padding = 3
log.Infof("\033[1m%s\033[0m", strings.ToUpper(pipe.String()))
handler.Padding = 6
if err := handle(pipe.Run(ctx)); err != nil {
return err
}
}
log.Infof("\033[1mSUCCESS!\033[0m")
handler.Padding = 3
return nil
}

View File

@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"time"
"github.com/apex/log"
lcli "github.com/apex/log/handlers/cli"
@ -64,11 +65,13 @@ func main() {
},
}
app.Action = func(c *cli.Context) error {
log.Infof("running goreleaser %v", version)
start := time.Now()
log.Infof("\033[1mreleasing...\033[0m")
if err := goreleaserlib.Release(c); err != nil {
log.WithError(err).Error("release failed")
log.WithError(err).Errorf("\033[1mrelease failed after %0.2fs\033[0m", time.Since(start).Seconds())
return cli.NewExitError("\n", 1)
}
log.Infof("\033[1mrelease succeeded after %0.2fs\033[0m", time.Since(start).Seconds())
return nil
}
app.Commands = []cli.Command{

View File

@ -40,7 +40,7 @@ func (Pipe) Run(ctx *context.Context) error {
ctx.Config.Dist = "dist"
}
for _, defaulter := range defaulters {
log.Infof("\t%s", defaulter.String())
log.Info(defaulter.String())
if err := defaulter.Default(ctx); err != nil {
return err
}