demotape 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  "name": "demotape",
3
3
  "displayName": "Demo Tape",
4
4
  "description": "Syntax highlighting for DemoTape (.tape) files",
5
- "version": "0.0.3",
5
+ "version": "0.0.5",
6
6
  "publisher": "fnando",
7
7
  "icon": "icon.png",
8
8
  "license": "MIT",
@@ -15,12 +15,16 @@
15
15
  "files": [
16
16
  "*.json",
17
17
  "*.png",
18
+ "snippets",
18
19
  "LICENSE.md",
19
20
  "README.md"
20
21
  ],
21
22
  "categories": [
22
23
  "Programming Languages"
23
24
  ],
25
+ "devDependencies": {
26
+ "@vscode/vsce": "*"
27
+ },
24
28
  "contributes": {
25
29
  "languages": [
26
30
  {
@@ -41,6 +45,12 @@
41
45
  "scopeName": "source.demotape",
42
46
  "path": "./demotape.tmLanguage.json"
43
47
  }
48
+ ],
49
+ "snippets": [
50
+ {
51
+ "language": "demotape",
52
+ "path": "./snippets/demotape.json"
53
+ }
44
54
  ]
45
55
  }
46
56
  }
@@ -0,0 +1,542 @@
1
+ {
2
+ "Type": {
3
+ "prefix": "Type",
4
+ "body": ["Type \"${1:text}\""],
5
+ "description": "Type text command"
6
+ },
7
+ "Type with duration": {
8
+ "prefix": "Type@",
9
+ "body": ["Type@${1:50ms} \"${2:text}\""],
10
+ "description": "Type text with custom duration"
11
+ },
12
+ "TypeFile": {
13
+ "prefix": "TypeFile",
14
+ "body": ["TypeFile \"${1:path/to/file}\""],
15
+ "description": "Type file contents"
16
+ },
17
+ "TypeFile with duration": {
18
+ "prefix": "TypeFile@",
19
+ "body": ["TypeFile@${1:50ms} \"${2:path/to/file}\""],
20
+ "description": "Type file contents with custom duration"
21
+ },
22
+ "Run": {
23
+ "prefix": "Run",
24
+ "body": ["Run \"${1:command}\""],
25
+ "description": "Run shell command"
26
+ },
27
+ "Run with duration": {
28
+ "prefix": "Run@",
29
+ "body": ["Run@${1:1s} \"${2:command}\""],
30
+ "description": "Run shell command with custom duration"
31
+ },
32
+ "Copy": {
33
+ "prefix": "Copy",
34
+ "body": ["Copy \"${1:text}\""],
35
+ "description": "Copy text to clipboard"
36
+ },
37
+ "Paste": {
38
+ "prefix": "Paste",
39
+ "body": ["Paste"],
40
+ "description": "Paste from clipboard"
41
+ },
42
+ "Send": {
43
+ "prefix": "Send",
44
+ "body": ["Send \"${1:text}\""],
45
+ "description": "Send text"
46
+ },
47
+ "Include": {
48
+ "prefix": "Include",
49
+ "body": ["Include \"${1:file.tape}\""],
50
+ "description": "Include another tape file"
51
+ },
52
+ "Screenshot": {
53
+ "prefix": "Screenshot",
54
+ "body": ["Screenshot \"${1:output.png}\""],
55
+ "description": "Take screenshot"
56
+ },
57
+ "Require": {
58
+ "prefix": "Require",
59
+ "body": ["Require \"${1:file}\""],
60
+ "description": "Require file or command"
61
+ },
62
+ "Output": {
63
+ "prefix": "Output",
64
+ "body": ["Output \"${1:output.gif}\""],
65
+ "description": "Set output file"
66
+ },
67
+ "Wait": {
68
+ "prefix": "Wait",
69
+ "body": ["Wait ${1:1s}"],
70
+ "description": "Wait for duration"
71
+ },
72
+ "Sleep": {
73
+ "prefix": "Sleep",
74
+ "body": ["Sleep ${1:1s}"],
75
+ "description": "Sleep for duration"
76
+ },
77
+ "WaitUntil": {
78
+ "prefix": "WaitUntil",
79
+ "body": ["WaitUntil /${1:pattern}/"],
80
+ "description": "Wait until pattern matches"
81
+ },
82
+ "WaitUntil with duration": {
83
+ "prefix": "WaitUntil@",
84
+ "body": ["WaitUntil@${1:5s} /${2:pattern}/"],
85
+ "description": "Wait until pattern matches with timeout"
86
+ },
87
+ "WaitUntilDone": {
88
+ "prefix": "WaitUntilDone",
89
+ "body": ["WaitUntilDone"],
90
+ "description": "Wait until command completes"
91
+ },
92
+ "WaitUntilDone with duration": {
93
+ "prefix": "WaitUntilDone@",
94
+ "body": ["WaitUntilDone@${1:5s}"],
95
+ "description": "Wait until command completes with timeout"
96
+ },
97
+ "Clear": {
98
+ "prefix": "Clear",
99
+ "body": ["Clear"],
100
+ "description": "Clear screen"
101
+ },
102
+ "Pause": {
103
+ "prefix": "Pause",
104
+ "body": ["Pause"],
105
+ "description": "Pause recording"
106
+ },
107
+ "Resume": {
108
+ "prefix": "Resume",
109
+ "body": ["Resume"],
110
+ "description": "Resume recording"
111
+ },
112
+ "Set shell": {
113
+ "prefix": "Set shell",
114
+ "body": ["Set shell \"${1:zsh}\""],
115
+ "description": "Set shell"
116
+ },
117
+ "Set theme": {
118
+ "prefix": "Set theme",
119
+ "body": ["Set theme \"${1:dark_theme}\""],
120
+ "description": "Set theme"
121
+ },
122
+ "Set width": {
123
+ "prefix": "Set width",
124
+ "body": ["Set width ${1:1200}"],
125
+ "description": "Set terminal width"
126
+ },
127
+ "Set height": {
128
+ "prefix": "Set height",
129
+ "body": ["Set height ${1:600}"],
130
+ "description": "Set terminal height"
131
+ },
132
+ "Set font_size": {
133
+ "prefix": "Set font_size",
134
+ "body": ["Set font_size ${1:14}"],
135
+ "description": "Set font size"
136
+ },
137
+ "Set font_family": {
138
+ "prefix": "Set font_family",
139
+ "body": ["Set font_family \"${1:Monaco}\""],
140
+ "description": "Set font family"
141
+ },
142
+ "Set line_height": {
143
+ "prefix": "Set line_height",
144
+ "body": ["Set line_height ${1:1.2}"],
145
+ "description": "Set line height"
146
+ },
147
+ "Set cursor_blink": {
148
+ "prefix": "Set cursor_blink",
149
+ "body": ["Set cursor_blink ${1:true}"],
150
+ "description": "Set cursor blink"
151
+ },
152
+ "Set cursor_width": {
153
+ "prefix": "Set cursor_width",
154
+ "body": ["Set cursor_width ${1:2}"],
155
+ "description": "Set cursor width"
156
+ },
157
+ "Set cursor_style": {
158
+ "prefix": "Set cursor_style",
159
+ "body": ["Set cursor_style \"${1:block}\""],
160
+ "description": "Set cursor style"
161
+ },
162
+ "Set letter_spacing": {
163
+ "prefix": "Set letter_spacing",
164
+ "body": ["Set letter_spacing ${1:0}"],
165
+ "description": "Set letter spacing"
166
+ },
167
+ "Set padding": {
168
+ "prefix": "Set padding",
169
+ "body": ["Set padding ${1:20}"],
170
+ "description": "Set padding"
171
+ },
172
+ "Set margin": {
173
+ "prefix": "Set margin",
174
+ "body": ["Set margin ${1:60}"],
175
+ "description": "Set margin"
176
+ },
177
+ "Set margin_fill": {
178
+ "prefix": "Set margin_fill",
179
+ "body": ["Set margin_fill \"${1:#6b50ff}\""],
180
+ "description": "Set margin fill color"
181
+ },
182
+ "Set border_radius": {
183
+ "prefix": "Set border_radius",
184
+ "body": ["Set border_radius ${1:10}"],
185
+ "description": "Set border radius"
186
+ },
187
+ "Set typing_speed": {
188
+ "prefix": "Set typing_speed",
189
+ "body": ["Set typing_speed ${1:50ms}"],
190
+ "description": "Set typing speed"
191
+ },
192
+ "Set variable_typing": {
193
+ "prefix": "Set variable_typing",
194
+ "body": ["Set variable_typing ${1:true}"],
195
+ "description": "Set variable typing"
196
+ },
197
+ "Set loop": {
198
+ "prefix": "Set loop",
199
+ "body": ["Set loop ${1:true}"],
200
+ "description": "Set loop"
201
+ },
202
+ "Set loop_delay": {
203
+ "prefix": "Set loop_delay",
204
+ "body": ["Set loop_delay ${1:2s}"],
205
+ "description": "Set loop delay"
206
+ },
207
+ "Set timeout": {
208
+ "prefix": "Set timeout",
209
+ "body": ["Set timeout ${1:2s}"],
210
+ "description": "Set demo tape timeout"
211
+ },
212
+ "Set run_enter_delay": {
213
+ "prefix": "Set run_enter_delay",
214
+ "body": ["Set run_enter_delay ${1:300ms}"],
215
+ "description": "Set run enter delay"
216
+ },
217
+ "Set run_sleep": {
218
+ "prefix": "Set run_sleep",
219
+ "body": ["Set run_sleep ${1:1s}"],
220
+ "description": "Set run sleep duration"
221
+ },
222
+ "Set theme.background": {
223
+ "prefix": "Set theme.background",
224
+ "body": ["Set theme.background \"${1:#222222}\""],
225
+ "description": "Set theme background color"
226
+ },
227
+ "Set theme.foreground": {
228
+ "prefix": "Set theme.foreground",
229
+ "body": ["Set theme.foreground \"${1:#ffffff}\""],
230
+ "description": "Set theme foreground color"
231
+ },
232
+ "Set theme.cursor": {
233
+ "prefix": "Set theme.cursor",
234
+ "body": ["Set theme.cursor \"${1:#00ff00}\""],
235
+ "description": "Set theme cursor color"
236
+ },
237
+ "Set theme.selection_background": {
238
+ "prefix": "Set theme.selection_background",
239
+ "body": ["Set theme.selection_background \"${1:#444444}\""],
240
+ "description": "Set theme selection background color"
241
+ },
242
+ "Set theme.black": {
243
+ "prefix": "Set theme.black",
244
+ "body": ["Set theme.black \"${1:#000000}\""],
245
+ "description": "Set theme black color"
246
+ },
247
+ "Set theme.red": {
248
+ "prefix": "Set theme.red",
249
+ "body": ["Set theme.red \"${1:#ff0000}\""],
250
+ "description": "Set theme red color"
251
+ },
252
+ "Set theme.green": {
253
+ "prefix": "Set theme.green",
254
+ "body": ["Set theme.green \"${1:#00ff00}\""],
255
+ "description": "Set theme green color"
256
+ },
257
+ "Set theme.yellow": {
258
+ "prefix": "Set theme.yellow",
259
+ "body": ["Set theme.yellow \"${1:#ffff00}\""],
260
+ "description": "Set theme yellow color"
261
+ },
262
+ "Set theme.blue": {
263
+ "prefix": "Set theme.blue",
264
+ "body": ["Set theme.blue \"${1:#0000ff}\""],
265
+ "description": "Set theme blue color"
266
+ },
267
+ "Set theme.magenta": {
268
+ "prefix": "Set theme.magenta",
269
+ "body": ["Set theme.magenta \"${1:#ff00ff}\""],
270
+ "description": "Set theme magenta color"
271
+ },
272
+ "Set theme.cyan": {
273
+ "prefix": "Set theme.cyan",
274
+ "body": ["Set theme.cyan \"${1:#00ffff}\""],
275
+ "description": "Set theme cyan color"
276
+ },
277
+ "Set theme.white": {
278
+ "prefix": "Set theme.white",
279
+ "body": ["Set theme.white \"${1:#ffffff}\""],
280
+ "description": "Set theme white color"
281
+ },
282
+ "Set theme.bright_black": {
283
+ "prefix": "Set theme.bright_black",
284
+ "body": ["Set theme.bright_black \"${1:#555555}\""],
285
+ "description": "Set theme bright black color"
286
+ },
287
+ "Set theme.bright_red": {
288
+ "prefix": "Set theme.bright_red",
289
+ "body": ["Set theme.bright_red \"${1:#ff5555}\""],
290
+ "description": "Set theme bright red color"
291
+ },
292
+ "Set theme.bright_green": {
293
+ "prefix": "Set theme.bright_green",
294
+ "body": ["Set theme.bright_green \"${1:#55ff55}\""],
295
+ "description": "Set theme bright green color"
296
+ },
297
+ "Set theme.bright_yellow": {
298
+ "prefix": "Set theme.bright_yellow",
299
+ "body": ["Set theme.bright_yellow \"${1:#ffff55}\""],
300
+ "description": "Set theme bright yellow color"
301
+ },
302
+ "Set theme.bright_blue": {
303
+ "prefix": "Set theme.bright_blue",
304
+ "body": ["Set theme.bright_blue \"${1:#5555ff}\""],
305
+ "description": "Set theme bright blue color"
306
+ },
307
+ "Set theme.bright_magenta": {
308
+ "prefix": "Set theme.bright_magenta",
309
+ "body": ["Set theme.bright_magenta \"${1:#ff55ff}\""],
310
+ "description": "Set theme bright magenta color"
311
+ },
312
+ "Set theme.bright_cyan": {
313
+ "prefix": "Set theme.bright_cyan",
314
+ "body": ["Set theme.bright_cyan \"${1:#55ffff}\""],
315
+ "description": "Set theme bright cyan color"
316
+ },
317
+ "Set theme.bright_white": {
318
+ "prefix": "Set theme.bright_white",
319
+ "body": ["Set theme.bright_white \"${1:#ffffff}\""],
320
+ "description": "Set theme bright white color"
321
+ },
322
+ "Enter": {
323
+ "prefix": "Enter",
324
+ "body": ["Enter"],
325
+ "description": "Enter key"
326
+ },
327
+ "Return": {
328
+ "prefix": "Return",
329
+ "body": ["Return"],
330
+ "description": "Return key"
331
+ },
332
+ "Tab": {
333
+ "prefix": "Tab",
334
+ "body": ["Tab"],
335
+ "description": "Tab key"
336
+ },
337
+ "Backspace": {
338
+ "prefix": "Backspace",
339
+ "body": ["Backspace"],
340
+ "description": "Backspace key"
341
+ },
342
+ "Delete": {
343
+ "prefix": "Delete",
344
+ "body": ["Delete"],
345
+ "description": "Delete key"
346
+ },
347
+ "Escape": {
348
+ "prefix": "Escape",
349
+ "body": ["Escape"],
350
+ "description": "Escape key"
351
+ },
352
+ "Space": {
353
+ "prefix": "Space",
354
+ "body": ["Space"],
355
+ "description": "Space key"
356
+ },
357
+ "Up": {
358
+ "prefix": "Up",
359
+ "body": ["Up"],
360
+ "description": "Up arrow key"
361
+ },
362
+ "Down": {
363
+ "prefix": "Down",
364
+ "body": ["Down"],
365
+ "description": "Down arrow key"
366
+ },
367
+ "Left": {
368
+ "prefix": "Left",
369
+ "body": ["Left"],
370
+ "description": "Left arrow key"
371
+ },
372
+ "Right": {
373
+ "prefix": "Right",
374
+ "body": ["Right"],
375
+ "description": "Right arrow key"
376
+ },
377
+ "Home": {
378
+ "prefix": "Home",
379
+ "body": ["Home"],
380
+ "description": "Home key"
381
+ },
382
+ "End": {
383
+ "prefix": "End",
384
+ "body": ["End"],
385
+ "description": "End key"
386
+ },
387
+ "PageUp": {
388
+ "prefix": "PageUp",
389
+ "body": ["PageUp"],
390
+ "description": "Page Up key"
391
+ },
392
+ "PageDown": {
393
+ "prefix": "PageDown",
394
+ "body": ["PageDown"],
395
+ "description": "Page Down key"
396
+ },
397
+ "Insert": {
398
+ "prefix": "Insert",
399
+ "body": ["Insert"],
400
+ "description": "Insert key"
401
+ },
402
+ "F1": {
403
+ "prefix": "F1",
404
+ "body": ["F1"],
405
+ "description": "F1 key"
406
+ },
407
+ "F2": {
408
+ "prefix": "F2",
409
+ "body": ["F2"],
410
+ "description": "F2 key"
411
+ },
412
+ "F3": {
413
+ "prefix": "F3",
414
+ "body": ["F3"],
415
+ "description": "F3 key"
416
+ },
417
+ "F4": {
418
+ "prefix": "F4",
419
+ "body": ["F4"],
420
+ "description": "F4 key"
421
+ },
422
+ "F5": {
423
+ "prefix": "F5",
424
+ "body": ["F5"],
425
+ "description": "F5 key"
426
+ },
427
+ "F6": {
428
+ "prefix": "F6",
429
+ "body": ["F6"],
430
+ "description": "F6 key"
431
+ },
432
+ "F7": {
433
+ "prefix": "F7",
434
+ "body": ["F7"],
435
+ "description": "F7 key"
436
+ },
437
+ "F8": {
438
+ "prefix": "F8",
439
+ "body": ["F8"],
440
+ "description": "F8 key"
441
+ },
442
+ "F9": {
443
+ "prefix": "F9",
444
+ "body": ["F9"],
445
+ "description": "F9 key"
446
+ },
447
+ "F10": {
448
+ "prefix": "F10",
449
+ "body": ["F10"],
450
+ "description": "F10 key"
451
+ },
452
+ "F11": {
453
+ "prefix": "F11",
454
+ "body": ["F11"],
455
+ "description": "F11 key"
456
+ },
457
+ "F12": {
458
+ "prefix": "F12",
459
+ "body": ["F12"],
460
+ "description": "F12 key"
461
+ },
462
+ "Ctrl": {
463
+ "prefix": "Ctrl",
464
+ "body": ["Ctrl"],
465
+ "description": "Ctrl modifier"
466
+ },
467
+ "Control": {
468
+ "prefix": "Control",
469
+ "body": ["Control"],
470
+ "description": "Control modifier"
471
+ },
472
+ "Alt": {
473
+ "prefix": "Alt",
474
+ "body": ["Alt"],
475
+ "description": "Alt modifier"
476
+ },
477
+ "Option": {
478
+ "prefix": "Option",
479
+ "body": ["Option"],
480
+ "description": "Option modifier"
481
+ },
482
+ "Shift": {
483
+ "prefix": "Shift",
484
+ "body": ["Shift"],
485
+ "description": "Shift modifier"
486
+ },
487
+ "Meta": {
488
+ "prefix": "Meta",
489
+ "body": ["Meta"],
490
+ "description": "Meta modifier"
491
+ },
492
+ "Command": {
493
+ "prefix": "Command",
494
+ "body": ["Command"],
495
+ "description": "Command modifier"
496
+ },
497
+ "Ctrl+": {
498
+ "prefix": "Ctrl+",
499
+ "body": ["Ctrl+${1:C}"],
500
+ "description": "Ctrl key combination"
501
+ },
502
+ "Alt+": {
503
+ "prefix": "Alt+",
504
+ "body": ["Alt+${1:Tab}"],
505
+ "description": "Alt key combination"
506
+ },
507
+ "Shift+": {
508
+ "prefix": "Shift+",
509
+ "body": ["Shift+${1:Enter}"],
510
+ "description": "Shift key combination"
511
+ },
512
+ "Command+": {
513
+ "prefix": "Command+",
514
+ "body": ["Command+${1:C}"],
515
+ "description": "Command key combination"
516
+ },
517
+ "Meta+": {
518
+ "prefix": "Meta+",
519
+ "body": ["Meta+${1:C}"],
520
+ "description": "Meta key combination"
521
+ },
522
+ "Duration milliseconds": {
523
+ "prefix": "ms",
524
+ "body": ["${1:100}ms"],
525
+ "description": "Duration in milliseconds"
526
+ },
527
+ "Duration seconds": {
528
+ "prefix": "s",
529
+ "body": ["${1:1}s"],
530
+ "description": "Duration in seconds"
531
+ },
532
+ "Duration minutes": {
533
+ "prefix": "m",
534
+ "body": ["${1:1}m"],
535
+ "description": "Duration in minutes"
536
+ },
537
+ "Duration hours": {
538
+ "prefix": "h",
539
+ "body": ["${1:1}h"],
540
+ "description": "Duration in hours"
541
+ }
542
+ }
@@ -1,12 +1,13 @@
1
1
  id = "demotape"
2
2
  name = "Demo Tape"
3
3
  description = "Syntax highlighting for Demo Tape terminal recording scripts"
4
- version = "0.0.1"
4
+ version = "0.0.2"
5
5
  schema_version = 1
6
6
  authors = ["Nando Vieira <me@fnando.com>"]
7
- repository = "https://github.com/fnando/demotape"
7
+ repository = "https://github.com/fnando/zed-demotape"
8
+ snippets = "./snippets/demotape.json"
8
9
 
9
10
  [grammars.demotape]
10
- repository = "https://github.com/fnando/demotape"
11
+ repository = "https://github.com/fnando/zed-demotape"
11
12
  rev = "main"
12
- path = "editors/zed/tree-sitter"
13
+ path = "tree-sitter"
Binary file
data/lib/demo_tape/cli.rb CHANGED
@@ -140,6 +140,9 @@ module DemoTape
140
140
  type: :numeric,
141
141
  default: 3,
142
142
  desc: "Delay (in seconds) after running each command"
143
+ option :timeout,
144
+ type: :numeric,
145
+ desc: "Maximum time (in seconds) to allow the demo tape to run"
143
146
  def _run(file_path = "")
144
147
  options = self.options.dup
145
148
  options[:padding] =
@@ -101,7 +101,7 @@ module DemoTape
101
101
  SET_OPTIONS = %w[
102
102
  border_radius cursor_blink cursor_style cursor_width font_family font_size
103
103
  height line_height loop loop_delay margin margin_fill padding shell theme
104
- typing_speed variable_typing width
104
+ typing_speed variable_typing width timeout
105
105
  ].freeze
106
106
 
107
107
  attr_reader :type, :args, :options, :children
@@ -343,7 +343,7 @@ module DemoTape
343
343
  # Set attribute DURATION
344
344
  rules.push identifier("Set") +
345
345
  identifier("loop_delay", "run_sleep", "run_enter_delay",
346
- "typing_speed") +
346
+ "typing_speed", "timeout") +
347
347
  duration
348
348
 
349
349
  # Set attribute BOOLEAN
@@ -355,7 +355,7 @@ module DemoTape
355
355
  rules.push identifier("Set") +
356
356
  identifier("width", "height", "cursor_width", "font_size",
357
357
  "padding", "margin", "loop_delay", "line_height",
358
- "border_radius", "typing_speed") +
358
+ "border_radius", "typing_speed", "timeout") +
359
359
  number
360
360
 
361
361
  # Set attribute STRING