go/src/cmd/internal/script/conds.go

// DefaultConds returns a set of broadly useful script conditions.
//
// Run the 'help' command within a script engine to view a list of the available
// conditions.
func DefaultConds() map[string]Cond {}

// Condition returns a Cond with the given summary and evaluation function.
func Condition(summary string, eval func(*State) (bool, error)) Cond {}

type funcCond

func (c *funcCond) Usage() *CondUsage {}

func (c *funcCond) Eval(s *State, suffix string) (bool, error) {}

// PrefixCondition returns a Cond with the given summary and evaluation function.
func PrefixCondition(summary string, eval func(*State, string) (bool, error)) Cond {}

type prefixCond

func (c *prefixCond) Usage() *CondUsage {}

func (c *prefixCond) Eval(s *State, suffix string) (bool, error) {}

// BoolCondition returns a Cond with the given truth value and summary.
// The Cond rejects the use of condition suffixes.
func BoolCondition(summary string, v bool) Cond {}

type boolCond

func (b *boolCond) Usage() *CondUsage {}

func (b *boolCond) Eval(s *State, suffix string) (bool, error) {}

// OnceCondition returns a Cond that calls eval the first time the condition is
// evaluated. Future calls reuse the same result.
//
// The eval function is not passed a *State because the condition is cached
// across all execution states and must not vary by state.
func OnceCondition(summary string, eval func() (bool, error)) Cond {}

type onceCond

func (l *onceCond) Usage() *CondUsage {}

func (l *onceCond) Eval(s *State, suffix string) (bool, error) {}

// CachedCondition is like Condition but only calls eval the first time the
// condition is evaluated for a given suffix.
// Future calls with the same suffix reuse the earlier result.
//
// The eval function is not passed a *State because the condition is cached
// across all execution states and must not vary by state.
func CachedCondition(summary string, eval func(string) (bool, error)) Cond {}

type cachedCond

func (c *cachedCond) Usage() *CondUsage {}

func (c *cachedCond) Eval(_ *State, suffix string) (bool, error) {}