2023-09-11 17:09:08 +00:00
|
|
|
/*
|
|
|
|
Copyright © 2023 Seednode <seednode@seedno.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
2023-09-13 14:26:15 +00:00
|
|
|
type filters struct {
|
|
|
|
included []string
|
|
|
|
excluded []string
|
2023-09-11 17:09:08 +00:00
|
|
|
}
|
|
|
|
|
2023-09-13 14:26:15 +00:00
|
|
|
func (filters *filters) isEmpty() bool {
|
|
|
|
return !(filters.hasIncludes() || filters.hasExcludes())
|
2023-09-11 17:09:08 +00:00
|
|
|
}
|
|
|
|
|
2023-09-13 14:26:15 +00:00
|
|
|
func (filters *filters) hasIncludes() bool {
|
|
|
|
return len(filters.included) != 0
|
2023-09-11 17:09:08 +00:00
|
|
|
}
|
|
|
|
|
2023-09-13 14:26:15 +00:00
|
|
|
func (filters *filters) includes() string {
|
|
|
|
return strings.Join(filters.included, ",")
|
2023-09-11 17:09:08 +00:00
|
|
|
}
|
|
|
|
|
2023-09-13 14:26:15 +00:00
|
|
|
func (filters *filters) hasExcludes() bool {
|
|
|
|
return len(filters.excluded) != 0
|
2023-09-11 17:09:08 +00:00
|
|
|
}
|
|
|
|
|
2023-09-13 14:26:15 +00:00
|
|
|
func (filters *filters) excludes() string {
|
|
|
|
return strings.Join(filters.excluded, ",")
|
2023-09-11 17:09:08 +00:00
|
|
|
}
|