41 lines
513 B
Go
41 lines
513 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 OpFromString(s string) Op {
|
|
return fromString(s)
|
|
}
|
|
|
|
func fromString(s string) Op {
|
|
for i := 0; i < 20; i++ {
|
|
if Op(i).String() == s {
|
|
return Op(i)
|
|
}
|
|
}
|
|
return Op(-1)
|
|
}
|