mirror of
https://github.com/onyx-and-iris/vbantxt.git
synced 2024-11-21 17:30:49 +00:00
onyx-and-iris
2bdabdae03
loglevel flag now uses logrus constants (0 up to 6) config values are only applied if the corresponding flag wasn't passed isFlagPassed() added to util.go
24 lines
366 B
Go
24 lines
366 B
Go
package main
|
|
|
|
import "flag"
|
|
|
|
// indexOf returns the index of an element in an array
|
|
func indexOf[T comparable](collection []T, e T) int {
|
|
for i, x := range collection {
|
|
if x == e {
|
|
return i
|
|
}
|
|
}
|
|
return -1
|
|
}
|
|
|
|
func isFlagPassed(name string) bool {
|
|
found := false
|
|
flag.Visit(func(f *flag.Flag) {
|
|
if f.Name == name {
|
|
found = true
|
|
}
|
|
})
|
|
return found
|
|
}
|