MyTinyTodo2/mytinytodo/remote/op.go

37 lines
455 B
Go

package remote
type Op int
const (
NEW Op = iota
CLOSE Op = iota
OPEN Op = iota
LISTS Op = iota
TASKS Op = iota
)
func (op Op) String() string {
switch op {
case LISTS:
return "lists"
case TASKS:
return "tasks"
case NEW:
return "new"
case CLOSE:
return "close"
case OPEN:
return "open"
}
return ""
}
func fromString(s string) Op {
for i := 0; i < 20; i++ {
if Op(i).String() == s {
return Op(i)
}
}
return Op(-1)
}