mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 14:03:17 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
096767622a
commit
64af0c4290
2 changed files with 9 additions and 7 deletions
|
@ -41,15 +41,20 @@ func UniqueInts(a []int, sorted bool) []int {
|
||||||
return uniq
|
return uniq
|
||||||
}
|
}
|
||||||
|
|
||||||
func CommaSplit(csv string) []string {
|
func SepSplit(sv string, sep string) []string {
|
||||||
filtered := make([]string, 0)
|
filtered := make([]string, 0)
|
||||||
for _, part := range strings.Split(csv, ",") {
|
for _, part := range strings.Split(sv, sep) {
|
||||||
part = Trim(part)
|
part = Trim(part)
|
||||||
if part != "" {
|
if part != "" {
|
||||||
filtered = append(filtered, part)
|
filtered = append(filtered, part)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filtered
|
return filtered
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func CommaSplit(csv string) []string {
|
||||||
|
return SepSplit(csv, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExecSilent(executable string, args []string) (string, error) {
|
func ExecSilent(executable string, args []string) (string, error) {
|
||||||
|
|
|
@ -484,12 +484,9 @@ func (s *Session) isCapletCommand(line string) (is bool, filename string, argv [
|
||||||
}
|
}
|
||||||
|
|
||||||
capspath := core.Trim(os.Getenv("CAPSPATH"))
|
capspath := core.Trim(os.Getenv("CAPSPATH"))
|
||||||
for _, folder := range strings.Split(capspath, ":") {
|
for _, folder := range core.SepSplit(capspath, ":") {
|
||||||
folder = core.Trim(folder)
|
|
||||||
if folder != "" {
|
|
||||||
paths = append(paths, folder)
|
paths = append(paths, folder)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
file := core.Trim(line)
|
file := core.Trim(line)
|
||||||
parts := strings.Split(file, " ")
|
parts := strings.Split(file, " ")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue