Skip to content

Commit

Permalink
Minor fixes on getfoldstatus and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Neira committed Apr 10, 2024
1 parent b345676 commit 277447f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion temporalcli/commands.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,7 @@ func NewTemporalWorkflowTraceCommand(cctx *CommandContext, parent *TemporalWorkf
}
s.Command.Args = cobra.NoArgs
s.WorkflowReferenceOptions.buildFlags(cctx, s.Command.Flags())
s.Command.Flags().StringArrayVar(&s.Fold, "fold", nil, "Statuses for which Child Workflows will be folded in (this will reduce the number of information fetched and displayed). Case-insensitive and ignored if no-fold supplied. Defaults to completed, canceled and terminated. Available values: running, completed, failed, canceled, terminated, timedout, continueasnew.")
s.Command.Flags().StringArrayVar(&s.Fold, "fold", nil, "Statuses for which Child Workflows will be folded in (this will reduce the number of information fetched and displayed). Case-insensitive and ignored if no-fold supplied. Available values: running, completed, failed, canceled, terminated, timedout, continueasnew.")
s.Command.Flags().BoolVar(&s.NoFold, "no-fold", false, "Disable folding. All Child Workflows within the set depth will be fetched and displayed.")
s.Command.Flags().IntVar(&s.Depth, "depth", -1, "Depth of child workflows to fetch. Use -1 to fetch child workflows at any depth.")
s.Command.Flags().IntVar(&s.Concurrency, "concurrency", 10, "Number of concurrent workflow histories that will be requested at any given time.")
Expand Down
14 changes: 6 additions & 8 deletions temporalcli/commands.workflow_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import (
"syscall"
"time"

"github.com/temporalio/cli/temporalcli/internal/tracer"

"go.temporal.io/api/enums/v1"

"github.com/fatih/color"
"github.com/temporalio/cli/temporalcli/internal/printer"
"github.com/temporalio/cli/temporalcli/internal/tracer"
"go.temporal.io/api/enums/v1"
"go.temporal.io/sdk/client"
)

Expand All @@ -27,7 +25,7 @@ var workflowTraceFoldFlags = map[string]enums.WorkflowExecutionStatus{

func (c *TemporalWorkflowTraceCommand) getFoldStatuses() ([]enums.WorkflowExecutionStatus, error) {
// defaults
if len(foldFlags) == 0 {
if len(c.Fold) == 0 {
return []enums.WorkflowExecutionStatus{
enums.WORKFLOW_EXECUTION_STATUS_COMPLETED,
enums.WORKFLOW_EXECUTION_STATUS_CANCELED,
Expand All @@ -37,8 +35,8 @@ func (c *TemporalWorkflowTraceCommand) getFoldStatuses() ([]enums.WorkflowExecut

// parse flags
var values []enums.WorkflowExecutionStatus
for _, flag := range foldFlags {
status, ok := foldFlag[flag]
for _, flag := range c.Fold {
status, ok := workflowTraceFoldFlags[flag]
if !ok {
return nil, fmt.Errorf("fold status %q not recognized", flag)
}
Expand All @@ -62,7 +60,7 @@ func (c *TemporalWorkflowTraceCommand) run(cctx *CommandContext, _ []string) err
Concurrency: c.Concurrency,
NoFold: c.NoFold,
}
opts.FoldStatuses, err = getFoldStatuses(c.Fold)
opts.FoldStatuses, err = c.getFoldStatuses()
if err != nil {
return err
}
Expand Down
4 changes: 1 addition & 3 deletions temporalcli/commands.workflow_trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import (
"time"

"go.temporal.io/api/enums/v1"

"go.temporal.io/sdk/workflow"

"go.temporal.io/sdk/client"
"go.temporal.io/sdk/workflow"
)

func (s *SharedServerSuite) TestWorkflow_Trace_Summary() {
Expand Down

0 comments on commit 277447f

Please sign in to comment.