summaryrefslogtreecommitdiff
path: root/complete.go
diff options
context:
space:
mode:
Diffstat (limited to 'complete.go')
-rw-r--r--complete.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/complete.go b/complete.go
index 5a73931..0cd7513 100644
--- a/complete.go
+++ b/complete.go
@@ -92,24 +92,24 @@ func (c CleanCmd) Match(partial string) []string {
}
// sends the strings to bash or zsh that will be your options
-func (a args) SendCompletionStrings(pb *argvpb.Argv) {
- if pb.IsMatch("mode.config") {
+func (a args) DoAutoComplete() error {
+ if argvpb.PB.IsMatch("mode.config") {
matches := []string{"mine", "favorites"}
fmt.Fprintf(argvpb.Stdout, strings.Join(matches, " "))
- return
+ return nil
}
- if pb.IsMatch("mode") {
+ if argvpb.PB.IsMatch("mode") {
matches := []string{"once", "many", "mine", "favorites"}
fmt.Fprintf(argvpb.Stdout, strings.Join(matches, " "))
- return
+ return nil
}
- if pb.GetCmd() == "" {
+ if argvpb.PB.GetCmd() == "" {
// these are base autocomplete strings
matches := []string{"clean", "commit", "merge", "patch", "normal", "pull", "rebuild", "generate", "config"}
matches = append(matches, "show", "add", "fixer", "dev", "verify", "mode", "gui", "whatchanged")
matches = append(matches, "--version", "--force", "--all")
fmt.Fprintf(argvpb.Stdout, strings.Join(matches, " "))
- return
+ return nil
}
var err error
if me.pp == nil {
@@ -117,6 +117,7 @@ func (a args) SendCompletionStrings(pb *argvpb.Argv) {
fmt.Fprintf(argvpb.Stderr, "returned from parseFlagsArgv(%v)\n", err)
}
err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, argvpb.PB.Real...)
- fmt.Fprintf(argvpb.Stderr, "returned from WriteHelpForAutocomplete() pb.Real(%v)\n", pb.Real)
+ fmt.Fprintf(argvpb.Stderr, "returned from WriteHelpForAutocomplete() pb.Real(%v)\n", argvpb.PB.Real)
fmt.Fprintf(argvpb.Stderr, "returned from WriteHelpForAutocomplete(%v)\n", err)
+ return err
}