1
0
mirror of https://github.com/netsampler/goflow2.git synced 2024-05-06 15:54:52 +00:00
2022-10-08 15:29:06 -07:00

37 lines
672 B
Go

package common
import (
"flag"
"strings"
"sync"
)
var (
selectorVar string
selector []string // Hashing fields
selectorTag string // Hashing fields
selectorDeclared bool
selectorDeclaredLock = &sync.Mutex{}
)
func SelectorFlag() {
selectorDeclaredLock.Lock()
defer selectorDeclaredLock.Unlock()
if selectorDeclared {
return
}
selectorDeclared = true
flag.StringVar(&selectorVar, "format.selector", "", "List of fields to do keep in output")
flag.StringVar(&selectorTag, "format.tag", "", "Use format tag")
}
func ManualSelectorInit() error {
if selectorVar == "" {
return nil
}
selector = strings.Split(selectorVar, ",")
return nil
}