mirror of
https://github.com/rsteube/carapace-bin.git
synced 2025-05-05 15:32:53 +00:00
20 lines
338 B
Go
20 lines
338 B
Go
package condition
|
|
|
|
import (
|
|
"github.com/rsteube/carapace"
|
|
)
|
|
|
|
type Condition func(c carapace.Context) bool
|
|
|
|
// Of combines different conditions.
|
|
func Of(conditions ...Condition) Condition {
|
|
return func(c carapace.Context) bool {
|
|
for _, condition := range conditions {
|
|
if !condition(c) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
}
|