mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
f2614f2107
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
24 lines
427 B
Go
24 lines
427 B
Go
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
|
|
}
|