diff options
Diffstat (limited to 'cmd.go')
-rw-r--r-- | cmd.go | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -33,6 +33,11 @@ package libfastimport type fiReader interface { PeekLine() (string, error) ReadLine() (string, error) + SetCommandMark(int) +} + +type fiReaderState interface { + GetCommandMark() int } type fiWriter interface { @@ -54,9 +59,13 @@ const ( type Cmd interface { fiCmdRead(fiReader) (Cmd, error) fiCmdWrite(fiWriter) error - fiCmdClass() cmdClass + fiCmdClass(fiReaderState) cmdClass } -func cmdIs(cmd Cmd, class cmdClass) bool { - return cmd.fiCmdClass()&class != 0 +type noopReaderState struct{} + +func (_ noopReaderState) GetCommandMark() int { return 0 } + +func cmdIs(state fiReaderState, cmd Cmd, class cmdClass) bool { + return cmd.fiCmdClass(state)&class != 0 } |