提交 e273949f 编写于 作者: I Ilia Choly 提交者: Derek Parker

Add basic tab completion to terminal

上级 e2acf8ce
......@@ -51,6 +51,17 @@ func (t *Term) Run() (error, int) {
if t.conf != nil && t.conf.Aliases != nil {
cmds.Merge(t.conf.Aliases)
}
t.line.SetCompleter(func(line string) (c []string) {
for _, cmd := range cmds.cmds {
for _, alias := range cmd.aliases {
if strings.HasPrefix(alias, strings.ToLower(line)) {
c = append(c, alias)
}
}
}
return
})
fullHistoryFile, err := config.GetConfigFilePath(historyFile)
if err != nil {
fmt.Printf("Unable to load history file: %v.", err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册