new: implemented proper dynamic tab completion for every available command and module (fixes #14)

This commit is contained in:
evilsocket 2018-01-14 14:00:58 +01:00
parent 1fc64d564e
commit 64c35fe846
4 changed files with 103 additions and 28 deletions

View file

@ -1,10 +1,14 @@
package session
import "regexp"
import (
"github.com/chzyer/readline"
"regexp"
)
type CommandHandler struct {
Name string
Description string
Completer *readline.PrefixCompleter
Parser *regexp.Regexp
Exec func(args []string, s *Session) error
}
@ -13,6 +17,7 @@ func NewCommandHandler(name string, expr string, desc string, exec func(args []s
return CommandHandler{
Name: name,
Description: desc,
Completer: nil,
Parser: regexp.MustCompile(expr),
Exec: exec,
}