Skip to content

Commit

Permalink
[CSE-14] Display new errors and warnings in the CLI (#17)
Browse files Browse the repository at this point in the history
* update node

* UI tweaks

* fixing a comment
  • Loading branch information
decarboxy authored Mar 15, 2019
1 parent 1878655 commit befb551
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/argo/commands/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ const (
FgDefault = 39
)

//useful icons
var (
YellowWarning = ansiFormat("⚠", FgYellow)
RedError = ansiFormat("✖", FgRed)
)

func initializeSession() {
jobStatusIconMap = map[wfv1.NodePhase]string{
wfv1.NodePending: ansiFormat("◷", FgYellow),
Expand Down
22 changes: 22 additions & 0 deletions cmd/argo/commands/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,28 @@ func printWorkflowHelper(wf *wfv1.Workflow, outFmt string) {
}
}
}

errorWriter := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)

if wf.Status.Errors != nil || wf.Status.Warnings != nil {

fmt.Printf("\nErrors and Warnings:\n")
fmt.Fprintf(errorWriter, "%s\tPODNAME\tCODE\tMESSAGE\n", ansiFormat("STEP", FgDefault))
}

if wf.Status.Errors != nil {
for _, errorResult := range wf.Status.Errors {
fmt.Fprintf(errorWriter, "%s %s\t%s\t%s\t%s\n", RedError, errorResult.StepName, errorResult.PodId, errorResult.Name, errorResult.Message)
}
}

if wf.Status.Warnings != nil {
for _, warningResult := range wf.Status.Warnings {
fmt.Fprintf(errorWriter, "%s %s\t%s\t%s\t%s\n", YellowWarning, warningResult.StepName, warningResult.PodId, warningResult.Name, warningResult.Message)
}
}
_ = errorWriter.Flush()

printTree := true
if wf.Status.Nodes == nil {
printTree = false
Expand Down

0 comments on commit befb551

Please sign in to comment.