Skip to content

Commit

Permalink
Decruft deploy, add arrows to context
Browse files Browse the repository at this point in the history
  • Loading branch information
codepope committed Jun 18, 2020
1 parent 61ea7cd commit c8c7596
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
28 changes: 7 additions & 21 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,33 +197,19 @@ func runDeploy(commandContext *cmdctx.CmdContext) error {
return err
}

spinning := !commandContext.OutputJSON()

s := spinner.New(spinner.CharSets[11], 100*time.Millisecond)
if spinning {
s.Writer = os.Stderr
s.Prefix = "Building "
s.Start()
}
s.Writer = os.Stderr
s.Prefix = "Building "
s.Start()

buildMonitor := builds.NewBuildMonitor(build.ID, commandContext.Client.API())
for line := range buildMonitor.Logs(ctx) {
if spinning {
s.Stop()
}
//fmt.Println(line)
commandContext.Status("build", line)
if spinning {
s.Start()
}
fmt.Println(line)
}

if spinning {
s.FinalMSG = fmt.Sprintf("Build complete - %s\n", buildMonitor.Status())
s.Stop()
} else {
commandContext.Statusf("build", cmdctx.SDONE, "Build complete - %s\n", buildMonitor.Status())
}
s.FinalMSG = fmt.Sprintf("Build complete - %s\n", buildMonitor.Status())
s.Stop()

if err := buildMonitor.Err(); err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions cmdctx/cmdcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ func statusToEffect(status string, message string) string {
case SDETAIL:
return aurora.Faint(message).String()
case STITLE:
return aurora.Bold("\n" + message).Black().String()
return aurora.Bold(message).Black().String()
case SBEGIN:
return aurora.Green("\n" + message).String()
return aurora.Green("==> " + message).String()
case SDONE:
return aurora.Gray(20, message).String()
return aurora.Gray(20, "--> "+message).String()
case SERROR:
return aurora.Red(message).String()
return aurora.Red("***" + message).String()
}

return message
Expand Down

0 comments on commit c8c7596

Please sign in to comment.