Skip to content

Commit

Permalink
🔧 added a check when no command is found
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufcanb committed Mar 10, 2024
1 parent 4602caf commit f6762da
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions suggest/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ func (s *Suggest) action(c *cli.Context) error {
}

fmt.Printf(shell.SuccessMessage("┃ >")+" Thinking... (%s)\n", t2.Sub(t1).String())
if len(s.extractCommandsFromResponse(responseText)) == 0 {
fmt.Println(shell.WarnMessage("┃ >") + " No command found for given prompt..." + "\n")
return nil
}

form := NewCommandForm(s.extractCommandsFromResponse(responseText)[0])
err = form.Run()

Expand Down

0 comments on commit f6762da

Please sign in to comment.