Skip to content

Commit

Permalink
add auto-autocompletion of commands
Browse files Browse the repository at this point in the history
  • Loading branch information
yabobay committed Nov 22, 2023
1 parent 9698ecd commit c3d92b5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -2750,7 +2750,13 @@ func (e *callExpr) eval(app *app, args []string) {
default:
cmd, ok := gOpts.cmds[e.name]
if !ok {
app.ui.echoerrf("command not found: %s", e.name)
completions, _ := completeCmd([]rune(e.name))
if len(completions) == 0 {
app.ui.echoerrf("command not found: %s", e.name)
} else {
e.name = completions[0]
e.eval(app, args)
}
return
}
cmd.eval(app, e.args)
Expand Down

0 comments on commit c3d92b5

Please sign in to comment.