Skip to content

Commit 8217e61

Browse files
committed
disable slices on abc variables commands
1 parent 2259cc6 commit 8217e61

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

cmd/src/abc_variables_delete.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var abcVariablesDeleteCommand = clicompat.Wrap(&cli.Command{
1616
Name: "delete",
1717
Usage: "Delete variables on a workflow instance",
1818
UsageText: "src abc variables delete [options] <workflow-instance-id> [<name> ...]",
19+
DisableSliceFlagSeparator: true,
1920
Description: `
2021
Delete workflow instance variables
2122

cmd/src/abc_variables_set.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var abcVariablesSetCommand = clicompat.Wrap(&cli.Command{
2828
Name: "set",
2929
UsageText: "src abc variables set [options] <workflow-instance-id> [<name>=<value> ...]",
3030
Usage: "Set variables on a workflow instance",
31+
DisableSliceFlagSeparator: true,
3132
Description: `
3233
Set workflow instance variables
3334

cmd/src/abc_variables_set_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
mockapi "github.com/sourcegraph/src-cli/internal/api/mock"
1010
"github.com/stretchr/testify/mock"
1111
"github.com/stretchr/testify/require"
12+
"github.com/urfave/cli/v3"
1213
)
1314

1415
// If we were to do a json marshalling roundtrip, it may break large integer literals.
@@ -48,6 +49,27 @@ func TestParseABCVariables(t *testing.T) {
4849
}
4950
}
5051

52+
func TestABCVariablesSetVarFlagPreservesCommas(t *testing.T) {
53+
t.Parallel()
54+
55+
var got []string
56+
cmd := &cli.Command{
57+
Name: "set",
58+
DisableSliceFlagSeparator: abcVariablesSetCommand.DisableSliceFlagSeparator,
59+
Flags: []cli.Flag{
60+
&cli.StringSliceFlag{Name: "var"},
61+
},
62+
Action: func(ctx context.Context, cmd *cli.Command) error {
63+
got = cmd.StringSlice("var")
64+
return nil
65+
},
66+
}
67+
68+
err := cmd.Run(context.Background(), []string{"set", "--var", "checkpoints=[1,2,3]"})
69+
require.NoError(t, err)
70+
require.Equal(t, []string{"checkpoints=[1,2,3]"}, got)
71+
}
72+
5173
func TestRunABCVariablesSet(t *testing.T) {
5274
t.Parallel()
5375

0 commit comments

Comments
 (0)