mow.cli: github.com/jawher/mow.cli/internal/fsm/fsmtest Index | Files

package fsmtest

import "github.com/jawher/mow.cli/internal/fsm/fsmtest"

Index

Package Files

fsmtest.go

func FsmStr Uses

func FsmStr(s *fsm.State) string

FsmStr generates a string representation of the provided FSM

func NewFsm Uses

func NewFsm(spec string, matchers map[string]matcher.Matcher) *fsm.State

NewFsm constructs an FSM from the provided string spec and a list of defined matchers The spec syntax is:

S1 t1 S2 S2 t2 (S3) <source state name> <transition name> <target state name>

states between parenthesis are final states

func TransitionStrs Uses

func TransitionStrs(trs fsm.StateTransitions) []string

TransitionStrs returns a string slice with the transitions names

type NopeMatcher Uses

type NopeMatcher struct{}

NopeMatcher is a matcher that always fails

func (NopeMatcher) Match Uses

func (NopeMatcher) Match(args []string, c *matcher.ParseContext) (bool, []string)

Match always returns false without consuming any args

func (NopeMatcher) Priority Uses

func (NopeMatcher) Priority() int

Priority returns the magic value 666

func (NopeMatcher) String Uses

func (NopeMatcher) String() string

type TestMatcher Uses

type TestMatcher struct {
    MatchFunc    func(args []string, c *matcher.ParseContext) (bool, []string)
    TestPriority int
}

TestMatcher is a matcher with a configurable match function and priority

func (TestMatcher) Match Uses

func (t TestMatcher) Match(args []string, c *matcher.ParseContext) (bool, []string)

Match executes the provided match func

func (TestMatcher) Priority Uses

func (t TestMatcher) Priority() int

Priority returns the provided priority

type YepMatcher Uses

type YepMatcher struct{}

YepMatcher is a matcher that always succeeds without consuming any args

func (YepMatcher) Match Uses

func (YepMatcher) Match(args []string, c *matcher.ParseContext) (bool, []string)

Match always returns true without consuming any args

func (YepMatcher) Priority Uses

func (YepMatcher) Priority() int

Priority returns the magic value 666

func (YepMatcher) String Uses

func (YepMatcher) String() string

Package fsmtest imports 5 packages (graph). Updated 2017-11-11. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).