mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
refact: refactored commands parsing code into session.ParseCommands function
This commit is contained in:
parent
d7672f7ab7
commit
7eebea30d0
2 changed files with 15 additions and 9 deletions
|
@ -46,6 +46,17 @@ type Session struct {
|
|||
Events *EventPool `json:"-"`
|
||||
}
|
||||
|
||||
func ParseCommands(buffer string) []string {
|
||||
cmds := make([]string, 0)
|
||||
for _, cmd := range strings.Split(buffer, ";") {
|
||||
cmd = strings.Trim(cmd, "\r\n\t ")
|
||||
if cmd != "" {
|
||||
cmds = append(cmds, cmd)
|
||||
}
|
||||
}
|
||||
return cmds
|
||||
}
|
||||
|
||||
func New() (*Session, error) {
|
||||
var err error
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue