1
0
mirror of https://github.com/bettercap/bettercap.git synced 2025-03-12 04:36:03 -07:00

new: new clear session command

This commit is contained in:
evilsocket 2018-01-10 17:16:14 +01:00
parent 9f8aa21136
commit 29002eb0b8

@ -7,6 +7,8 @@ import (
"time"
"github.com/evilsocket/bettercap-ng/core"
"github.com/chzyer/readline"
)
func (s *Session) helpHandler(args []string, sess *Session) error {
@ -145,6 +147,11 @@ func (s *Session) setHandler(args []string, sess *Session) error {
return nil
}
func (s *Session) clsHandler(args []string, sess *Session) error {
readline.ClearScreen(s.Input.Stdout())
return nil
}
func (s *Session) registerCoreHandlers() {
s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("help",
"^(help|\\?)$",
@ -180,4 +187,9 @@ func (s *Session) registerCoreHandlers() {
"^set\\s+([^\\s]+)\\s+(.+)",
"Set the VALUE of variable NAME.",
s.setHandler))
s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("clear",
"^(clear|cls)$",
"Clear the screen.",
s.clsHandler))
}