refact: refactored several strings.Trim calls to core.Trim

This commit is contained in:
evilsocket 2018-02-05 18:09:59 +01:00
commit ca9f4f0945
10 changed files with 35 additions and 23 deletions

View file

@ -52,7 +52,7 @@ type Session struct {
func ParseCommands(buffer string) []string {
cmds := make([]string, 0)
for _, cmd := range strings.Split(buffer, ";") {
cmd = strings.Trim(cmd, "\r\n\t ")
cmd = core.Trim(cmd)
if cmd != "" || (len(cmd) > 0 && cmd[0] != '#') {
cmds = append(cmds, cmd)
}
@ -338,7 +338,7 @@ func (s *Session) RunCaplet(filename string) error {
}
func (s *Session) Run(line string) error {
line = strings.TrimRight(line, " ")
line = core.TrimRight(line)
for _, h := range s.CoreHandlers {
if parsed, args := h.Parse(line); parsed == true {
return h.Exec(args, s)