mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
new: implemented proper dynamic tab completion for every available command and module (fixes #14)
This commit is contained in:
parent
1fc64d564e
commit
64c35fe846
4 changed files with 103 additions and 28 deletions
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue