demotape 0.0.5 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d2d9c7696e6ae9e4a0013f5e431e2ce1140ea7a536ce3027b7d1fe055835be7
4
- data.tar.gz: 96318b40137c65f80b9a25d1d7aef2a9d2b5abda54137b3155fad72d22c65df4
3
+ metadata.gz: 9703d45771aaa186b951e020ed1f30f6eb0ef4c12aa9de87a55cc6b229dacb07
4
+ data.tar.gz: 3f16d0099cffbc04e345c062e04c176dcec891063177bcdb2850056b2f24d29f
5
5
  SHA512:
6
- metadata.gz: 3ae5db1753a91ef17835e0a77ec046ef05a8b67245a8fc86634eb51216fee0216a5d2596402ccddbb12074982dae06b1d7ef3e315b266ac61f8c318cb5db0e5f
7
- data.tar.gz: f53681e7e489a9390905ce79fc47c8417f9fb2df65cc13496a7c58737e8f6cd9cbc4d209a925043f78a526bde42504fd4b025557d370fa0cb94c61c0157e97de
6
+ metadata.gz: e71e511638f3bb46d93bc332f79df365c9a80e5a6daef615500685a1f9e5a7760e37bbb7e0f2faf333a5a439685439defe0140baab13fdbcf2119d8ac718871f
7
+ data.tar.gz: d563b7107de203799897fcf840f045f8d73b009a7e9a60c54f16f55f61b0570accfbe656756603abb32a845aaed304fc7151a911103bdd273197ad42efa82099
data/CHANGELOG.md CHANGED
@@ -11,6 +11,18 @@ Prefix your message with one of the following:
11
11
  - [Security] in case of vulnerabilities.
12
12
  -->
13
13
 
14
+ ## v0.0.7
15
+
16
+ - [Fixed] Fix key combos that had numbers in them not being recognized.
17
+
18
+ ## v0.0.6
19
+
20
+ - [Added] Add `demotape run --working-dir` to specify the working directory for
21
+ commands. Notice that this changes all path references to be relative to the
22
+ working directory, including `--output-path` (if it's a relative path).
23
+ - [Fixed] Fix issue where `Set typing_speed` wasn't recognized.
24
+ - [Fixed] Fix issue where `Set shell` wasn't recognized.
25
+
14
26
  ## v0.0.5
15
27
 
16
28
  - [Changed] Add newline to multiline strings if they don't end with one.
data/README.md CHANGED
@@ -109,6 +109,11 @@ $ echo "Type 'echo \"it works with stdin too\"'\nEnter\nSleep 5" | \
109
109
  info Finished in 11.92s
110
110
  ```
111
111
 
112
+ > [!TIP]
113
+ >
114
+ > Notice that when using `--working-dir`, all path references will be relative
115
+ > to the working directory, including `--output-path`.
116
+
112
117
  ### Output formats
113
118
 
114
119
  - When exporting videos, you can choose between `.mp4`, `.webm` or `.avi`.
@@ -85,7 +85,7 @@ contexts:
85
85
  push: possible_key_count
86
86
 
87
87
  # Modifiers
88
- - match: '\b(Ctrl|Control|Alt|Option|Shift|Meta|Command)\b'
88
+ - match: '\b(Ctrl|Control|Alt|Option|Shift|Meta|Command|Cmd)\b'
89
89
  scope: keyword.control.demotape
90
90
  push: key_combo
91
91
 
@@ -32,7 +32,7 @@ syn match demotapeKey "\<Numpad[0-9]\>"
32
32
  syn match demotapeKey "\<F\([1-9]\|1[0-2]\)\>"
33
33
 
34
34
  " Modifiers
35
- syn keyword demotapeModifier Ctrl Control Alt Option Shift Meta Command
35
+ syn keyword demotapeModifier Ctrl Control Alt Option Shift Meta Command Cmd
36
36
 
37
37
  " Key combination operator
38
38
  syn match demotapeOperator "+"
@@ -95,7 +95,7 @@
95
95
  },
96
96
  {
97
97
  "comment": "Modifiers",
98
- "match": "\\b(Ctrl|Control|Alt|Option|Shift|Meta|Command)\\b",
98
+ "match": "\\b(Ctrl|Control|Alt|Option|Shift|Meta|Command|Cmd)\\b",
99
99
  "name": "keyword.control.demotape"
100
100
  },
101
101
  {
@@ -187,7 +187,7 @@ module.exports = grammar({
187
187
  ),
188
188
 
189
189
  modifier_key: $ => choice(
190
- 'Ctrl', 'Control', 'Alt', 'Option', 'Shift', 'Meta', 'Command'
190
+ 'Ctrl', 'Control', 'Alt', 'Option', 'Shift', 'Meta', 'Command', 'Cmd'
191
191
  ),
192
192
 
193
193
  letter_key: $ => /[A-Za-z0-9]/,
data/lib/demo_tape/cli.rb CHANGED
@@ -13,6 +13,10 @@ module DemoTape
13
13
  end
14
14
 
15
15
  desc "run PATH", "Runs a demo tape"
16
+ option :working_dir,
17
+ type: :string,
18
+ desc: "Working directory to run the commands in",
19
+ default: Dir.pwd
16
20
  option :typing_speed,
17
21
  type: :string,
18
22
  default: "50ms",
@@ -158,7 +162,9 @@ module DemoTape
158
162
  content = File.read(file_path)
159
163
  end
160
164
 
161
- Runner.new(file_path:, content:, thor: shell, options:).run
165
+ Dir.chdir(options.working_dir) do
166
+ Runner.new(file_path:, content:, thor: shell, options:).run
167
+ end
162
168
  end
163
169
 
164
170
  desc "themes", "Lists available built-in themes"
@@ -42,12 +42,26 @@ module DemoTape
42
42
  results.any?
43
43
  end
44
44
 
45
+ def |(other)
46
+ Any.new(self, other)
47
+ end
48
+
45
49
  def +(other)
46
50
  expectations << other
47
51
  self
48
52
  end
49
53
  end
50
54
 
55
+ class Any
56
+ def initialize(*types)
57
+ @types = types
58
+ end
59
+
60
+ def valid?(*)
61
+ @types.any? { it.valid?(*) }
62
+ end
63
+ end
64
+
51
65
  class Duration
52
66
  include Helpers
53
67
 
@@ -232,50 +246,38 @@ module DemoTape
232
246
  # Group invocations
233
247
  rules.push identifier(/^[a-z0-9_]+$/)
234
248
 
249
+ key = identifier(*Command::VALID_KEYS) | number
250
+
235
251
  # KEY+KEY
252
+ rules.push identifier(*Command::KEY_MAPPING.keys) + operator("+") + key
236
253
  rules.push identifier(*Command::KEY_MAPPING.keys) +
237
254
  operator("+") +
238
- identifier(*Command::VALID_KEYS)
255
+ key +
256
+ number
239
257
 
240
258
  # KEY+KEY+KEY
241
259
  rules.push identifier(*Command::KEY_MAPPING.keys) +
242
260
  operator("+") +
243
- identifier(*Command::VALID_KEYS) +
244
- operator("+") +
245
- identifier(*Command::VALID_KEYS)
246
-
247
- # KEY+KEY+KEY+KEY
248
- rules.push identifier(*Command::KEY_MAPPING.keys) +
249
- operator("+") +
250
- identifier(*Command::VALID_KEYS) +
251
- operator("+") +
252
- identifier(*Command::VALID_KEYS) +
261
+ key +
253
262
  operator("+") +
254
- identifier(*Command::VALID_KEYS)
255
-
256
- # KEY+KEY COUNT
257
- rules.push identifier(*Command::KEY_MAPPING.keys) +
258
- operator("+") +
259
- identifier(*Command::VALID_KEYS) +
260
- number
261
-
262
- # KEY+KEY+KEY COUNT
263
+ key
263
264
  rules.push identifier(*Command::KEY_MAPPING.keys) +
264
265
  operator("+") +
265
- identifier(*Command::VALID_KEYS) +
266
+ key +
266
267
  operator("+") +
267
- identifier(*Command::VALID_KEYS) +
268
+ key +
268
269
  number
269
270
 
270
- # KEY+KEY+KEY+KEY COUNT
271
- rules.push identifier(*Command::KEY_MAPPING.keys) +
272
- operator("+") +
273
- identifier(*Command::VALID_KEYS) +
274
- operator("+") +
275
- identifier(*Command::VALID_KEYS) +
276
- operator("+") +
277
- identifier(*Command::VALID_KEYS) +
278
- number
271
+ # KEY+KEY+KEY+KEY
272
+ key_combo = identifier(*Command::KEY_MAPPING.keys) +
273
+ operator("+") +
274
+ key +
275
+ operator("+") +
276
+ key +
277
+ operator("+") +
278
+ key
279
+ rules.push key_combo
280
+ rules.push key_combo.dup + number
279
281
 
280
282
  # COMMAND
281
283
  rules.push identifier(
@@ -335,7 +337,8 @@ module DemoTape
335
337
 
336
338
  # Set attribute DURATION
337
339
  rules.push identifier("Set") +
338
- identifier("loop_delay", "run_sleep", "run_enter_delay") +
340
+ identifier("loop_delay", "run_sleep", "run_enter_delay",
341
+ "typing_speed") +
339
342
  duration
340
343
 
341
344
  # Set attribute BOOLEAN
@@ -347,12 +350,12 @@ module DemoTape
347
350
  rules.push identifier("Set") +
348
351
  identifier("width", "height", "cursor_width", "font_size",
349
352
  "padding", "margin", "loop_delay", "line_height",
350
- "border_radius") +
353
+ "border_radius", "typing_speed") +
351
354
  number
352
355
 
353
356
  # Set attribute STRING
354
357
  rules.push identifier("Set") +
355
- identifier("theme", "font_family", "margin_fill") +
358
+ identifier("theme", "font_family", "margin_fill", "shell") +
356
359
  string
357
360
 
358
361
  # Set cursor_style STRING
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DemoTape
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: demotape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
@@ -691,10 +691,10 @@ metadata:
691
691
  rubygems_mfa_required: 'true'
692
692
  homepage_uri: https://github.com/fnando/demotape
693
693
  bug_tracker_uri: https://github.com/fnando/demotape/issues
694
- source_code_uri: https://github.com/fnando/demotape/tree/v0.0.5
695
- changelog_uri: https://github.com/fnando/demotape/tree/v0.0.5/CHANGELOG.md
696
- documentation_uri: https://github.com/fnando/demotape/tree/v0.0.5/README.md
697
- license_uri: https://github.com/fnando/demotape/tree/v0.0.5/LICENSE.md
694
+ source_code_uri: https://github.com/fnando/demotape/tree/v0.0.7
695
+ changelog_uri: https://github.com/fnando/demotape/tree/v0.0.7/CHANGELOG.md
696
+ documentation_uri: https://github.com/fnando/demotape/tree/v0.0.7/README.md
697
+ license_uri: https://github.com/fnando/demotape/tree/v0.0.7/LICENSE.md
698
698
  rdoc_options: []
699
699
  require_paths:
700
700
  - lib