Skip to content

Commit

Permalink
Use ToString for CLI output (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshtin committed Jul 14, 2020
1 parent 004c86c commit 0eafe04
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions tools/cli/workflowCommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,7 @@ func queryWorkflowHelper(c *cli.Context, queryType string) {
if queryResponse.QueryRejected != nil {
fmt.Printf("Query was rejected, workflow has status: %v\n", queryResponse.QueryRejected.GetStatus())
} else {
var queryResult string
err = payloads.Decode(queryResponse.QueryResult, &queryResult)
if err != nil {
ErrorAndExit("Unable to decode query result.", err)
}
queryResult := payloads.ToString(queryResponse.QueryResult)
fmt.Printf("Query result:\n%v\n", queryResult)
}
}
Expand Down Expand Up @@ -1086,11 +1082,7 @@ func printRunStatus(event *historypb.HistoryEvent) {
switch event.GetEventType() {
case enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED:
fmt.Printf(" Status: %s\n", colorGreen("COMPLETED"))
var result string
err := payloads.Decode(event.GetWorkflowExecutionCompletedEventAttributes().GetResult(), &result)
if err != nil {
ErrorAndExit("Unable ot decode WorkflowExecutionCompletedEventAttributes.Result.", err)
}
result := payloads.ToString(event.GetWorkflowExecutionCompletedEventAttributes().GetResult())
fmt.Printf(" Output: %s\n", result)
case enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED:
fmt.Printf(" Status: %s\n", colorRed("FAILED"))
Expand All @@ -1100,11 +1092,7 @@ func printRunStatus(event *historypb.HistoryEvent) {
fmt.Printf(" Retry status: %s\n", event.GetWorkflowExecutionTimedOutEventAttributes().GetRetryState())
case enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED:
fmt.Printf(" Status: %s\n", colorRed("CANCELED"))
var details string
err := payloads.Decode(event.GetWorkflowExecutionCanceledEventAttributes().GetDetails(), &details)
if err != nil {
ErrorAndExit("Unable ot decode WorkflowExecutionCanceledEventAttributes.Details.", err)
}
details := payloads.ToString(event.GetWorkflowExecutionCanceledEventAttributes().GetDetails())
fmt.Printf(" Detail: %s\n", details)
}
}
Expand Down

0 comments on commit 0eafe04

Please sign in to comment.