@@ -23,30 +23,39 @@ var BitCmd = &cobra.Command{
2323 Run : func (cmd * cobra.Command , args []string ) {
2424 suggestionTree , bitCmdMap := CreateSuggestionMap (cmd )
2525
26- resp := SuggestionPrompt ( "> bit " , shellCommandCompleter ( suggestionTree ))
27- subCommand := resp
28- if subCommand == "" {
29- return
26+ repeat := os . Getenv ( "BIT_INTERACTIVE" ) == "TRUE"
27+ repeatAmount := 1
28+ if repeat {
29+ repeatAmount = 5000
3030 }
31- if strings .Index (resp , " " ) > 0 {
32- subCommand = subCommand [0 :strings .Index (resp , " " )]
33- }
34- parsedArgs , err := parseCommandLine (resp )
35- if err != nil {
36- log .Debug ().Err (err ).Send ()
37- return
38- }
39- if bitCmdMap [subCommand ] == nil {
40- yes := HijackGitCommandOccurred (parsedArgs , suggestionTree , cmd .Version )
41- if yes {
31+
32+
33+ for i := repeatAmount ; i > 0 ; i -- {
34+ resp := SuggestionPrompt ("> bit " , shellCommandCompleter (suggestionTree ))
35+ subCommand := resp
36+ if subCommand == "" {
4237 return
4338 }
44- RunGitCommandWithArgs (parsedArgs )
45- return
46- }
39+ if strings .Index (resp , " " ) > 0 {
40+ subCommand = subCommand [0 :strings .Index (resp , " " )]
41+ }
42+ parsedArgs , err := parseCommandLine (resp )
43+ if err != nil {
44+ log .Debug ().Err (err ).Send ()
45+ continue
46+ }
47+ if bitCmdMap [subCommand ] == nil {
48+ yes := HijackGitCommandOccurred (parsedArgs , suggestionTree , cmd .Version )
49+ if yes {
50+ continue
51+ }
52+ RunGitCommandWithArgs (parsedArgs )
53+ continue
54+ }
4755
48- cmd .SetArgs (parsedArgs )
49- cmd .Execute ()
56+ cmd .SetArgs (parsedArgs )
57+ cmd .Execute ()
58+ }
5059 },
5160}
5261
0 commit comments