Skip to content

Commit 06af16e

Browse files
authored
[BREAKING] Normalize semantic of --data args (#583)
1 parent 231b456 commit 06af16e

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

temporalcli/commands.gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ type TemporalOperatorNamespaceCreateCommand struct {
622622
Command cobra.Command
623623
ActiveCluster string
624624
Cluster []string
625-
Data string
625+
Data []string
626626
Description string
627627
Email string
628628
Global bool
@@ -647,7 +647,7 @@ func NewTemporalOperatorNamespaceCreateCommand(cctx *CommandContext, parent *Tem
647647
s.Command.Args = cobra.MaximumNArgs(1)
648648
s.Command.Flags().StringVar(&s.ActiveCluster, "active-cluster", "", "Active cluster name.")
649649
s.Command.Flags().StringArrayVar(&s.Cluster, "cluster", nil, "Cluster names.")
650-
s.Command.Flags().StringVar(&s.Data, "data", "", "Namespace data in key=value format. Use JSON for values.")
650+
s.Command.Flags().StringArrayVar(&s.Data, "data", nil, "Namespace data in key=value format. Use JSON for values.")
651651
s.Command.Flags().StringVar(&s.Description, "description", "", "Namespace description.")
652652
s.Command.Flags().StringVar(&s.Email, "email", "", "Owner email.")
653653
s.Command.Flags().BoolVar(&s.Global, "global", false, "Whether the namespace is a global namespace.")

temporalcli/commands.operator_namespace.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package temporalcli
22

33
import (
44
"fmt"
5-
"strings"
65

76
"github.com/fatih/color"
87
"github.com/temporalio/cli/temporalcli/internal/printer"
@@ -47,7 +46,7 @@ func (c *TemporalOperatorNamespaceCreateCommand) run(cctx *CommandContext, args
4746

4847
var data map[string]string
4948
if len(c.Data) > 0 {
50-
data, err = stringKeysValues(strings.Split(c.Data, ","))
49+
data, err = stringKeysValues(c.Data)
5150
if err != nil {
5251
return err
5352
}

temporalcli/commands.operator_namespace_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ func (s *SharedServerSuite) TestNamespaceUpdate() {
6969
"--description", "description before",
7070
"--email", "email@before",
7171
"--retention", "24h",
72+
"--data", "k1=v0",
73+
"--data", "k3=v3",
7274
"-n", nsName,
7375
)
7476
s.NoError(res.Err)
@@ -101,6 +103,7 @@ func (s *SharedServerSuite) TestNamespaceUpdate() {
101103
s.Equal(48*time.Hour, describeResp.Config.WorkflowExecutionRetentionTtl.AsDuration())
102104
s.Equal("v1", describeResp.NamespaceInfo.Data["k1"])
103105
s.Equal("v2", describeResp.NamespaceInfo.Data["k2"])
106+
s.Equal("v3", describeResp.NamespaceInfo.Data["k3"])
104107
}
105108

106109
func (s *SharedServerSuite) TestNamespaceUpdate_NamespaceDontExist() {

temporalcli/commandsmd/commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ For example, the Visibility Archive can be set on a separate URI.
310310

311311
* `--active-cluster` (string) - Active cluster name.
312312
* `--cluster` (string[]) - Cluster names.
313-
* `--data` (string) - Namespace data in key=value format. Use JSON for values.
313+
* `--data` (string[]) - Namespace data in key=value format. Use JSON for values.
314314
* `--description` (string) - Namespace description.
315315
* `--email` (string) - Owner email.
316316
* `--global` (bool) - Whether the namespace is a global namespace.
@@ -1065,7 +1065,7 @@ Use the options listed below to change the behavior of this command.
10651065
#### Options
10661066

10671067
* `--fold` (string[]) - 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.
1068-
* `--no-fold` (bool) - Disable folding. All Child Workflows within the set depth will be fetched and displayed.
1068+
* `--no-fold` (bool) - Disable folding. All Child Workflows within the set depth will be fetched and displayed.
10691069
* `--depth` (int) - Depth of child workflows to fetch. Use -1 to fetch child workflows at any depth. Default: -1.
10701070
* `--concurrency` (int) - Number of concurrent workflow histories that will be requested at any given time. Default: 10.
10711071

0 commit comments

Comments
 (0)