summaryrefslogtreecommitdiff
path: root/cmd.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2021-08-31 19:54:25 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2021-08-31 19:54:25 -0600
commit43a997529328c0ebbe50b79ccb6ad830abbcd983 (patch)
tree627df846ff98581ace3b6ad7f96cc428854d5680 /cmd.go
parentfa806f39c831c75d7dbfa3ac406eb2d14fe04cd3 (diff)
Fix that failing testfix
Diffstat (limited to 'cmd.go')
-rw-r--r--cmd.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/cmd.go b/cmd.go
index 73ea14c..77b1d67 100644
--- a/cmd.go
+++ b/cmd.go
@@ -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
}