Skip to content

Commit 7e7488b

Browse files
authored
feat: add write command model (#24)
1 parent 7f17da5 commit 7e7488b

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

models.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const (
3737
ZapScriptCmdExecute = "execute"
3838
ZapScriptCmdDelay = "delay"
3939
ZapScriptCmdEvaluate = "evaluate"
40+
ZapScriptCmdWrite = "write"
4041
ZapScriptCmdStop = "stop"
4142
ZapScriptCmdEcho = "echo"
4243
ZapScriptCmdControl = "control"
@@ -99,6 +100,10 @@ type CmdLaunchArgs struct {
99100
Path string `json:"path" arg:"position=1"`
100101
}
101102

103+
type CmdWriteArgs struct {
104+
Payload string `json:"payload" arg:"position=1"`
105+
}
106+
102107
type CmdNotice struct {
103108
Loader *bool `json:"loader"`
104109
Text string `json:"text" arg:"position=1"`

parser_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ func TestParse(t *testing.T) {
6060
},
6161
},
6262
},
63+
{
64+
name: "write command",
65+
input: `**write:'**launch:/games/snes/zelda.sfc||**echo:written'`,
66+
want: zapscript.Script{
67+
Cmds: []zapscript.Command{
68+
{
69+
Name: zapscript.ZapScriptCmdWrite,
70+
Args: []string{"**launch:/games/snes/zelda.sfc||**echo:written"},
71+
},
72+
},
73+
},
74+
},
6375
{
6476
name: "two commands separated",
6577
input: `**first:1,2||**second:3,4`,

0 commit comments

Comments
 (0)