Skip to content

Commit

Permalink
🐞 fix(tools command): panic when completion
Browse files Browse the repository at this point in the history
  • Loading branch information
WAY29 committed May 10, 2022
1 parent c473044 commit a384d9c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/tools/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func CmdSetSuggests(args []string, word string, currentLine string) []prompt.Sug

if len(args) == 3 {
return prompt.FilterHasPrefix(*output.GetSuggests(), word, true)
} else if len(args) == 2 {
} else if len(args) == 2 && prompts.Prompt.UseTool != nil {
return prompt.FilterHasPrefix(prompts.Prompt.UseTool.ArgSuggests, word, true)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/tools/setg.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func CmdSetGSuggests(args []string, word string, currentLine string) []prompt.Su

if len(args) == 3 {
return prompt.FilterHasPrefix(*output.GetSuggests(), word, true)
} else if len(args) == 2 {
} else if len(args) == 2 && prompts.Prompt.UseTool != nil {
return prompt.FilterHasPrefix(prompts.Prompt.UseTool.ArgSuggests, word, true)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/tools/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func CmdShowSuggests(args []string, word string, currentLine string) []prompt.Suggest {
if len(args) == 2 {
if len(args) == 2 && prompts.Prompt.UseTool != nil {
return prompt.FilterHasPrefix(prompts.Prompt.UseTool.ArgSuggests, word, true)
}
return suggest.EmptySuggests
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/tools/unset.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func CmdUnSetSuggests(args []string, word string, currentLine string) []prompt.Suggest {
if len(args) == 2 {
if len(args) == 2 && prompts.Prompt.UseTool != nil {
return prompt.FilterHasPrefix(prompts.Prompt.UseTool.ArgSuggests, word, true)
}
return suggest.EmptySuggests
Expand Down

0 comments on commit a384d9c

Please sign in to comment.