feat(spec): add partial
This commit is contained in:
@@ -2,7 +2,7 @@ package core
|
|||||||
|
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
type GeneratorFunc func(tokens []string, prefix string) []Suggestion
|
type GeneratorFunc func(tokens []string, prefix string, partial string) []Suggestion
|
||||||
|
|
||||||
// Spec defines a top-level CLI command
|
// Spec defines a top-level CLI command
|
||||||
type Spec struct {
|
type Spec struct {
|
||||||
@@ -135,7 +135,7 @@ func Lookup(input string) []Suggestion {
|
|||||||
|
|
||||||
// use generator if available
|
// use generator if available
|
||||||
if currentGen != nil {
|
if currentGen != nil {
|
||||||
genResults := currentGen(tokens[:depth], prefix)
|
genResults := currentGen(tokens[:depth], prefix, partial)
|
||||||
for _, g := range genResults {
|
for _, g := range genResults {
|
||||||
// extract simple name for prefix matching
|
// extract simple name for prefix matching
|
||||||
parts := strings.Split(g.Cmd, " ")
|
parts := strings.Split(g.Cmd, " ")
|
||||||
|
|||||||
Reference in New Issue
Block a user