summaryrefslogtreecommitdiff
path: root/cmd.go
diff options
context:
space:
mode:
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
}