@@ -99,6 +99,8 @@ func ListTaskListPartitions(c *cli.Context) error {
99
99
if err != nil {
100
100
return commoncli .Problem ("Required flag not found: " , err )
101
101
}
102
+ taskListType := strToTaskListType (c .String (FlagTaskListType )) // default type is decision
103
+
102
104
ctx , cancel , err := newContext (c )
103
105
defer cancel ()
104
106
if err != nil {
@@ -113,13 +115,16 @@ func ListTaskListPartitions(c *cli.Context) error {
113
115
if err != nil {
114
116
return commoncli .Problem ("Operation ListTaskListPartitions failed." , err )
115
117
}
116
- if len (response .DecisionTaskListPartitions ) > 0 {
117
- return printTaskListPartitions ("Decision" , response .DecisionTaskListPartitions )
118
- }
119
- if len (response .ActivityTaskListPartitions ) > 0 {
120
- return printTaskListPartitions ("Activity" , response .ActivityTaskListPartitions )
118
+
119
+ switch taskListType {
120
+ case types .TaskListTypeActivity :
121
+ return printTaskListPartitions (types .TaskListTypeActivity , response .ActivityTaskListPartitions )
122
+ case types .TaskListTypeDecision :
123
+ return printTaskListPartitions (types .TaskListTypeDecision , response .DecisionTaskListPartitions )
124
+ default :
125
+ // should never happen
126
+ return nil
121
127
}
122
- return nil
123
128
}
124
129
125
130
func printTaskListPollers (w io.Writer , pollers []* types.PollerInfo , taskListType types.TaskListType ) error {
@@ -136,7 +141,7 @@ func printTaskListPollers(w io.Writer, pollers []*types.PollerInfo, taskListType
136
141
}})
137
142
}
138
143
139
- func printTaskListPartitions (taskListType string , partitions []* types.TaskListPartitionMetadata ) error {
144
+ func printTaskListPartitions (taskListType types. TaskListType , partitions []* types.TaskListPartitionMetadata ) error {
140
145
table := []TaskListPartitionRow {}
141
146
for _ , partition := range partitions {
142
147
table = append (table , TaskListPartitionRow {
@@ -146,7 +151,7 @@ func printTaskListPartitions(taskListType string, partitions []*types.TaskListPa
146
151
})
147
152
}
148
153
return RenderTable (os .Stdout , table , RenderOptions {Color : true , OptionalColumns : map [string ]bool {
149
- "Activity Task List Partition" : taskListType == "Activity" ,
150
- "Decision Task List Partition" : taskListType == "Decision" ,
154
+ "Activity Task List Partition" : taskListType == types . TaskListTypeActivity ,
155
+ "Decision Task List Partition" : taskListType == types . TaskListTypeDecision ,
151
156
}})
152
157
}
0 commit comments