refact: refactored to use islazy and updated deps

This commit is contained in:
evilsocket 2018-10-10 19:00:25 +02:00
parent a2b3ee79fb
commit d070445225
238 changed files with 12662 additions and 1586 deletions

View file

@ -4,7 +4,7 @@ import (
"os"
"path/filepath"
"github.com/bettercap/bettercap/core"
"github.com/evilsocket/islazy/str"
)
const (
@ -26,8 +26,8 @@ var (
)
func init() {
for _, path := range core.SepSplit(core.Trim(os.Getenv(EnvVarName)), ":") {
if path = core.Trim(path); len(path) > 0 {
for _, path := range str.SplitBy(str.Trim(os.Getenv(EnvVarName)), ":") {
if path = str.Trim(path); len(path) > 0 {
LoadPaths = append(LoadPaths, path)
}
}

View file

@ -9,7 +9,8 @@ import (
"strings"
"sync"
"github.com/bettercap/bettercap/core"
"github.com/evilsocket/islazy/fs"
"github.com/evilsocket/islazy/str"
)
var (
@ -62,7 +63,7 @@ func Load(name string) (error, *Caplet) {
}
for _, filename := range names {
if core.Exists(filename) {
if fs.Exists(filename) {
cap := &Caplet{
Path: filename,
Code: make([]string, 0),
@ -77,7 +78,7 @@ func Load(name string) (error, *Caplet) {
scanner := bufio.NewScanner(input)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
line := core.Trim(scanner.Text())
line := str.Trim(scanner.Text())
if line == "" || line[0] == '#' {
continue
}