@@ -1188,7 +1188,7 @@ func TestDefaultCompleteWithFlags(t *testing.T) {
1188
1188
},
1189
1189
},
1190
1190
},
1191
- argv : []string {"cmd" , "--e" , "--generate-shell-completion" },
1191
+ argv : []string {"cmd" , "--e" , completionFlag },
1192
1192
env : map [string ]string {"SHELL" : "bash" },
1193
1193
expected : "--excitement\n " ,
1194
1194
},
@@ -1210,7 +1210,7 @@ func TestDefaultCompleteWithFlags(t *testing.T) {
1210
1210
},
1211
1211
},
1212
1212
},
1213
- argv : []string {"cmd" , "--e" , "--generate-shell-completion" },
1213
+ argv : []string {"cmd" , "--e" , completionFlag },
1214
1214
env : map [string ]string {"SHELL" : "bash" },
1215
1215
expected : "" ,
1216
1216
},
@@ -1232,7 +1232,7 @@ func TestDefaultCompleteWithFlags(t *testing.T) {
1232
1232
},
1233
1233
},
1234
1234
},
1235
- argv : []string {"cmd" , "--e" , "--" , "--generate-shell-completion" },
1235
+ argv : []string {"cmd" , "--e" , "--" , completionFlag },
1236
1236
env : map [string ]string {"SHELL" : "bash" },
1237
1237
expected : "" ,
1238
1238
},
@@ -1255,7 +1255,7 @@ func TestDefaultCompleteWithFlags(t *testing.T) {
1255
1255
},
1256
1256
},
1257
1257
},
1258
- argv : []string {"cmd" , "--generate-shell-completion" },
1258
+ argv : []string {"cmd" , completionFlag },
1259
1259
env : map [string ]string {"SHELL" : "bash" },
1260
1260
expected : "futz\n " ,
1261
1261
},
@@ -1278,7 +1278,7 @@ func TestDefaultCompleteWithFlags(t *testing.T) {
1278
1278
},
1279
1279
},
1280
1280
},
1281
- argv : []string {"cmd" , "--url" , "http://localhost:8000" , "h" , "--generate-shell-completion" },
1281
+ argv : []string {"cmd" , "--url" , "http://localhost:8000" , "h" , completionFlag },
1282
1282
env : map [string ]string {"SHELL" : "bash" },
1283
1283
expected : "help\n " ,
1284
1284
},
@@ -1298,7 +1298,7 @@ func TestDefaultCompleteWithFlags(t *testing.T) {
1298
1298
},
1299
1299
},
1300
1300
},
1301
- argv : []string {"cmd" , "putz" , "-e" , "--generate-shell-completion" },
1301
+ argv : []string {"cmd" , "putz" , "-e" , completionFlag },
1302
1302
env : map [string ]string {"SHELL" : "zsh" },
1303
1303
expected : "--excitement:an exciting flag\n " ,
1304
1304
},
@@ -1318,7 +1318,7 @@ func TestDefaultCompleteWithFlags(t *testing.T) {
1318
1318
},
1319
1319
},
1320
1320
},
1321
- argv : []string {"cmd" , "putz" , "-e" , "--generate-shell-completion" },
1321
+ argv : []string {"cmd" , "putz" , "-e" , completionFlag },
1322
1322
env : map [string ]string {"SHELL" : "zsh" },
1323
1323
expected : "--excitement\n " ,
1324
1324
},
@@ -1764,19 +1764,19 @@ func Test_checkShellCompleteFlag(t *testing.T) {
1764
1764
}{
1765
1765
{
1766
1766
name : "disable-shell-completion" ,
1767
- arguments : []string {"--generate-shell-completion" },
1767
+ arguments : []string {completionFlag },
1768
1768
cmd : & Command {},
1769
1769
wantShellCompletion : false ,
1770
- wantArgs : []string {"--generate-shell-completion" },
1770
+ wantArgs : []string {completionFlag },
1771
1771
},
1772
1772
{
1773
1773
name : "child-disable-shell-completion" ,
1774
- arguments : []string {"--generate-shell-completion" },
1774
+ arguments : []string {completionFlag },
1775
1775
cmd : & Command {
1776
1776
parent : & Command {},
1777
1777
},
1778
1778
wantShellCompletion : false ,
1779
- wantArgs : []string {"--generate-shell-completion" },
1779
+ wantArgs : []string {completionFlag },
1780
1780
},
1781
1781
{
1782
1782
name : "last argument isn't --generate-shell-completion" ,
@@ -1789,7 +1789,7 @@ func Test_checkShellCompleteFlag(t *testing.T) {
1789
1789
},
1790
1790
{
1791
1791
name : "arguments include double dash" ,
1792
- arguments : []string {"--" , "foo" , "--generate-shell-completion" },
1792
+ arguments : []string {"--" , "foo" , completionFlag },
1793
1793
cmd : & Command {
1794
1794
EnableShellCompletion : true ,
1795
1795
},
@@ -1798,7 +1798,7 @@ func Test_checkShellCompleteFlag(t *testing.T) {
1798
1798
},
1799
1799
{
1800
1800
name : "shell completion" ,
1801
- arguments : []string {"foo" , "--generate-shell-completion" },
1801
+ arguments : []string {"foo" , completionFlag },
1802
1802
cmd : & Command {
1803
1803
EnableShellCompletion : true ,
1804
1804
},
0 commit comments