@@ -3,7 +3,7 @@ package evgprompt
33import (
44 "chatton.com/evergreen-prompt/pkg/evergreen"
55 "chatton.com/evergreen-prompt/pkg/evergreen/client"
6- "chatton.com/evergreen-prompt/pkg/util/flagutil "
6+ "chatton.com/evergreen-prompt/pkg/util/flags "
77 "github.com/c-bata/go-prompt"
88 "strings"
99)
@@ -51,19 +51,10 @@ func (c *Completer) Complete(d prompt.Document) []prompt.Suggest {
5151 return nil
5252 }
5353
54- //if getLastWord(d) == "--uncommitted" {
55- // return nil
56- //}
57-
5854 if strings .HasPrefix (d .TextBeforeCursor (), "patch" ) {
5955 return patchSuggestions (d )
6056 }
6157
62- // don't display set-project if it has already been set.
63- if strings .Contains (d .TextBeforeCursor (), "set-project" ) {
64- return nil
65- }
66-
6758 return prompt .FilterFuzzy ([]prompt.Suggest {
6859 {
6960 Text : "patch" ,
@@ -77,23 +68,23 @@ func patchSuggestions(d prompt.Document) []prompt.Suggest {
7768 var suggestions []prompt.Suggest
7869
7970 // we only want to show suggestions when they have not yet been specified.
80- if flagutil .GetTaskValue (d .TextBeforeCursor ()) == "" {
71+ if flags .GetTaskValue (d .TextBeforeCursor ()) == "" {
8172 suggestions = append (suggestions ,
8273 prompt.Suggest {
8374 Text : "--task" ,
8475 Description : "Specify a task to run" ,
8576 })
8677 }
8778
88- if flagutil .GetBuildVariantValue (d .TextBeforeCursor ()) == "" {
79+ if flags .GetBuildVariantValue (d .TextBeforeCursor ()) == "" {
8980 suggestions = append (suggestions ,
9081 prompt.Suggest {
9182 Text : "--buildvariant" ,
9283 Description : "Specify a build variant" ,
9384 })
9485 }
9586
96- if flagutil .GetDescriptionValue (d .TextBeforeCursor ()) == "" {
87+ if flags .GetDescriptionValue (d .TextBeforeCursor ()) == "" {
9788 if ! strings .Contains (d .TextBeforeCursor (), "--description" ) {
9889 suggestions = append (suggestions ,
9990 prompt.Suggest {
@@ -103,7 +94,7 @@ func patchSuggestions(d prompt.Document) []prompt.Suggest {
10394 }
10495 }
10596
106- if flagutil .GetPriorityValue (d .TextBeforeCursor ()) == "" {
97+ if flags .GetPriorityValue (d .TextBeforeCursor ()) == "" {
10798 if ! strings .Contains (d .TextBeforeCursor (), "--priority" ) {
10899 suggestions = append (suggestions ,
109100 prompt.Suggest {
@@ -113,15 +104,15 @@ func patchSuggestions(d prompt.Document) []prompt.Suggest {
113104 }
114105 }
115106
116- if ! flagutil .HasSpecifiedUncommitted (d .TextBeforeCursor ()) {
107+ if ! flags .HasSpecifiedUncommitted (d .TextBeforeCursor ()) {
117108 suggestions = append (suggestions ,
118109 prompt.Suggest {
119110 Text : "--uncommitted" ,
120111 Description : "Include uncommitted changes" ,
121112 })
122113 }
123114
124- if flagutil .GetProjectValue (d .TextBeforeCursor ()) == "" {
115+ if flags .GetProjectValue (d .TextBeforeCursor ()) == "" {
125116 suggestions = append (suggestions ,
126117 prompt.Suggest {
127118 Text : "--project" ,
@@ -153,9 +144,9 @@ func (c *Completer) getTaskSuggestions(d prompt.Document) []prompt.Suggest {
153144
154145 // if we are getting the task and the buildvariant already specified, we need to show
155146 // only the tasks that contain this build varient otherwise we can show all the tasks.
156- buildvariantValue := flagutil .GetBuildVariantValue (d .TextBeforeCursor ())
147+ buildvariantValue := flags .GetBuildVariantValue (d .TextBeforeCursor ())
157148
158- if buildvariantValue == "" {
149+ if buildvariantValue == "" {
159150 for _ , t := range c .config .Tasks {
160151 suggestions = append (suggestions , prompt.Suggest {
161152 Text : t .Name ,
@@ -182,7 +173,7 @@ func (c *Completer) getBuildVariantSuggestions(d prompt.Document) []prompt.Sugge
182173
183174 // if we are getting the build variant and the task is already specified, we need to show
184175 // only the build variants that contain this task, otherwise we can show all the buildvariants.
185- taskValue := flagutil .GetTaskValue (d .TextBeforeCursor ())
176+ taskValue := flags .GetTaskValue (d .TextBeforeCursor ())
186177
187178 if taskValue == "" {
188179 for _ , bv := range c .config .BuildVariants {
0 commit comments