1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/vendor/src/github.com/Azure/go-ansiterm/ground_state.go

25 lines
427 B
Go
Raw Normal View History

package ansiterm
type GroundState struct {
BaseState
}
func (gs GroundState) Handle(b byte) (s State, e error) {
gs.parser.context.currentChar = b
nextState, err := gs.BaseState.Handle(b)
if nextState != nil || err != nil {
return nextState, err
}
switch {
case sliceContains(Printables, b):
return gs, gs.parser.print()
case sliceContains(Executors, b):
return gs, gs.parser.execute()
}
return gs, nil
}