7 // IsSingleFlagPresent checks presence of selected flag and whether it was used once.
8 func IsSingleFlagPresent(flag string, params []string) bool {
9 found := filterFlags(params, flag)
16 // IsFlagAbsent checks absence of selected flag in parameters.
17 func IsFlagAbsent(flag string, params []string) bool {
18 found := filterFlags(params, flag)
25 // filterFlags returns all occurrences of selected flag.
26 func filterFlags(strs []string, flag string) []string {
28 for _, str := range strs {
29 if strings.HasPrefix(str, flag) {
30 filtered = append(filtered, str)