qcmd 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/qcmd/cli.rb +11 -0
- data/lib/qcmd/commands.rb +10 -0
- data/lib/qcmd/version.rb +1 -1
- data/lib/vendor/sexpistol/sexpistol/sexpistol_parser.rb +2 -2
- data/spec/unit/parser_spec.rb +4 -4
- metadata +2 -2
data/lib/qcmd/cli.rb
CHANGED
@@ -302,6 +302,8 @@ module Qcmd
|
|
302
302
|
|
303
303
|
Qcmd.debug "[CLI handle_input] command: #{ command }; args: #{ args.inspect }"
|
304
304
|
|
305
|
+
# this is where qcmd decides how to handle user input
|
306
|
+
|
305
307
|
case command
|
306
308
|
when 'exit', 'quit', 'q'
|
307
309
|
print 'exiting...'
|
@@ -493,6 +495,15 @@ module Qcmd
|
|
493
495
|
log(:warning, "The select command should be in the form `select CUE_NUMBER`.")
|
494
496
|
end
|
495
497
|
|
498
|
+
# local ruby commands
|
499
|
+
when 'sleep'
|
500
|
+
if args.size != 2
|
501
|
+
log(:warning, "The sleep command expects one argument")
|
502
|
+
elsif !(args[1].is_a?(Fixnum) || args[1].is_a?(Float))
|
503
|
+
log(:warning, "The sleep command expects a number")
|
504
|
+
else
|
505
|
+
sleep args[1].to_f
|
506
|
+
end
|
496
507
|
else
|
497
508
|
if aliases[command]
|
498
509
|
Qcmd.debug "[CLI handle_input] using alias #{ command }"
|
data/lib/qcmd/commands.rb
CHANGED
@@ -270,6 +270,16 @@ aliases
|
|
270
270
|
|
271
271
|
See all the aliases.
|
272
272
|
|
273
|
+
|
274
|
+
sleep NUMBER
|
275
|
+
|
276
|
+
Pause qcmd execution for NUMBER seconds.
|
277
|
+
|
278
|
+
For example:
|
279
|
+
|
280
|
+
> cue 3 start; sleep 2; stop
|
281
|
+
|
282
|
+
Will start cue number 3, then stop it two seconds later.
|
273
283
|
]
|
274
284
|
end
|
275
285
|
end
|
data/lib/qcmd/version.rb
CHANGED
@@ -73,10 +73,10 @@ class SexpistolParser < StringScanner
|
|
73
73
|
elsif scan(/"([^"\\]|\\.)*"/)
|
74
74
|
eval(matched)
|
75
75
|
# Match a float literal
|
76
|
-
elsif scan(/[\-\+]? [0-9]+ ((e[0-9]+) | (\.[0-9]+(e[0-9]+)?)) (\s|$)/x)
|
76
|
+
elsif scan(/[\-\+]? [0-9]+ ((e[0-9]+) | (\.[0-9]+(e[0-9]+)?))(\)| )(\s|$)/x)
|
77
77
|
matched.to_f
|
78
78
|
# Match an integer literal
|
79
|
-
elsif scan(/[\-\+]?[0-9]+ (\s|$)/x)
|
79
|
+
elsif scan(/[\-\+]?[0-9]+(\)| )(\s|$)/x)
|
80
80
|
matched.to_i
|
81
81
|
# Match a comma (for comma quoting)
|
82
82
|
elsif scan(/'/)
|
data/spec/unit/parser_spec.rb
CHANGED
@@ -12,13 +12,13 @@ describe Qcmd::Parser do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should parse integers" do
|
15
|
-
tokens = Qcmd::Parser.parse 'go "word word" 10'
|
16
|
-
tokens.should eql([:go, 'word word', 10])
|
15
|
+
tokens = Qcmd::Parser.parse 'go "word word" 10 (rate 10)'
|
16
|
+
tokens.should eql([:go, 'word word', 10, [:rate, 10]])
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should parse floats" do
|
20
|
-
tokens = Qcmd::Parser.parse '1.1 go "word word" 10 -12.3 1.1.1 10.2'
|
21
|
-
tokens.should eql([1.1, :go, 'word word', 10, -12.3, :'1.1.1', 10.2])
|
20
|
+
tokens = Qcmd::Parser.parse '1.1 go ("word word" 10.2 -12.3 1.1.1 10.2)'
|
21
|
+
tokens.should eql([1.1, :go, ['word word', 10.2, -12.3, :'1.1.1', 10.2]])
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should parse invalid numbers as symbols" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qcmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dnssd
|