summaryrefslogtreecommitdiff
path: root/cmd.go
blob: 5e76708cbc2688a4c285427ba03ae08130d8974a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package libfastimport

import (
	"git.lukeshu.com/go/libfastimport/textproto"
)

type fiReader interface {
	PeekLine() (string, error)
	ReadLine() (string, error)
}

type cmdClass int

const (
	cmdClassCommand cmdClass = 1 // may be a top-level command
	cmdClassCommit  cmdClass = 2 // may be used within in a commit

	cmdClassComment cmdClass = cmdClassCommand | cmdClassCommit
)

type Cmd interface {
	fiCmdRead(fiReader) (Cmd, error)
	fiCmdWrite(*textproto.FIWriter) error
	fiCmdClass() cmdClass
}