Documentation
¶
Overview ¶
Package selector resolves target expressions against a named, tagged, grouped set of things. Hosts and printers are separate inventories with separate rules about what may be connected to, but the expression language is one language, and this is the only implementation of it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T any] struct { // Noun names one item in error messages: "host", "printer". Noun string // Items is every candidate. Items []T // Groups maps a group name to member names. Members are assumed to have // been validated against Items when the inventory was built. Groups map[string][]string Name func(T) string HasTag func(T, string) bool }
Set describes what an expression is resolved against.
func (Set[T]) Select ¶
Select resolves an expression into a de-duplicated, name-sorted list.
The expression is a comma separated list of terms. Each term is one of:
all every item @group every member of the named group #tag every item carrying the tag name an item name, which may contain glob wildcards (web-*)
A term prefixed with '!' subtracts its matches from the set instead of adding them, so "@prod,!#retired" means "everything in prod that is not tagged retired". Exclusions are applied after all inclusions regardless of where they appear in the expression.