Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5011,3 +5011,38 @@ func TestJSONExportCommand(t *testing.T) {
`
assert.JSONEq(t, expected, string(out))
}

func TestCommand_ExclusiveFlagsWithAfter(t *testing.T) {
var called bool
cmd := &Command{
Name: "bar",
MutuallyExclusiveFlags: []MutuallyExclusiveFlags{
{
Category: "cat1",
Flags: [][]Flag{
{
&StringFlag{
Name: "foo",
},
},
{
&StringFlag{
Name: "foo2",
},
},
},
},
},
After: func(ctx context.Context, cmd *Command) error {
called = true
return nil
},
}

require.Error(t, cmd.Run(buildTestContext(t), []string{
"bar",
"--foo", "v1",
"--foo2", "v2",
}))
require.True(t, called)
Comment thread
dearchap marked this conversation as resolved.
}