@@ -31,7 +31,7 @@ const (
3131// RuntimeComplete generates completion candidates for the given args and writes
3232// them to w. Each candidate is one line, optionally followed by a tab and
3333// description. The last line is a directive in the format ":<int>".
34- func RuntimeComplete (ctx context.Context , root Runner , args []string , w io.Writer ) {
34+ func RuntimeComplete (ctx context.Context , root Commander , args []string , w io.Writer ) {
3535 completions , directive := computeCompletions (ctx , root , args )
3636 for _ , c := range completions {
3737 fmt .Fprintln (w , c ) //nolint:errcheck // best-effort completion output
@@ -41,7 +41,7 @@ func RuntimeComplete(ctx context.Context, root Runner, args []string, w io.Write
4141
4242// computeCompletions resolves the command chain and returns completion
4343// candidates with a directive.
44- func computeCompletions (ctx context.Context , root Runner , args []string ) ([]string , ShellCompDirective ) {
44+ func computeCompletions (ctx context.Context , root Commander , args []string ) ([]string , ShellCompDirective ) {
4545 // Split args: everything except last is context, last is the prefix to complete.
4646 var contextArgs []string
4747 var toComplete string
@@ -170,7 +170,7 @@ func computeCompletions(ctx context.Context, root Runner, args []string) ([]stri
170170}
171171
172172// completeCommandFlags returns flag completions matching prefix.
173- func completeCommandFlags (cmd Runner , prefix string ) []string {
173+ func completeCommandFlags (cmd Commander , prefix string ) []string {
174174 flags := ScanFlags (cmd )
175175 var candidates []string
176176 for i := range flags {
@@ -222,7 +222,7 @@ func completeCommandFlags(cmd Runner, prefix string) []string {
222222
223223// lookupValueFlagName returns the flag name (without dashes) if arg matches
224224// a non-bool, non-counter flag on cmd, or empty string if not found.
225- func lookupValueFlagName (cmd Runner , arg string ) string {
225+ func lookupValueFlagName (cmd Commander , arg string ) string {
226226 if ! strings .HasPrefix (arg , "-" ) {
227227 return ""
228228 }
@@ -245,7 +245,7 @@ func lookupValueFlagName(cmd Runner, arg string) string {
245245
246246// lookupFlagEnum returns the Enum string for a flag matching the given arg
247247// (e.g. "--format"), or empty if no match or no enum.
248- func lookupFlagEnum (cmd Runner , arg string ) string {
248+ func lookupFlagEnum (cmd Commander , arg string ) string {
249249 if ! strings .HasPrefix (arg , "-" ) {
250250 return ""
251251 }
0 commit comments