File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -5011,3 +5011,38 @@ func TestJSONExportCommand(t *testing.T) {
50115011`
50125012 assert .JSONEq (t , expected , string (out ))
50135013}
5014+
5015+ func TestCommand_ExclusiveFlagsWithAfter (t * testing.T ) {
5016+ var called bool
5017+ cmd := & Command {
5018+ Name : "bar" ,
5019+ MutuallyExclusiveFlags : []MutuallyExclusiveFlags {
5020+ {
5021+ Category : "cat1" ,
5022+ Flags : [][]Flag {
5023+ {
5024+ & StringFlag {
5025+ Name : "foo" ,
5026+ },
5027+ },
5028+ {
5029+ & StringFlag {
5030+ Name : "foo2" ,
5031+ },
5032+ },
5033+ },
5034+ },
5035+ },
5036+ After : func (ctx context.Context , cmd * Command ) error {
5037+ called = true
5038+ return nil
5039+ },
5040+ }
5041+
5042+ require .Error (t , cmd .Run (buildTestContext (t ), []string {
5043+ "bar" ,
5044+ "--foo" , "v1" ,
5045+ "--foo2" , "v2" ,
5046+ }))
5047+ require .True (t , called )
5048+ }
You can’t perform that action at this time.
0 commit comments