exe/fusuma-sendkey in fusuma-plugin-sendkey-0.10.1 vs exe/fusuma-sendkey in fusuma-plugin-sendkey-0.11.0
- old
+ new
@@ -34,15 +34,27 @@
if option[:version]
puts Fusuma::Plugin::Sendkey::VERSION
return
end
-param = ARGV.first
+args = ARGV.first
-if param.nil?
+if args.nil?
warn 'fusuma-sendkey require 1 arugument'
warn 'e.g. fusuma-sendkey LEFTALT+LEFT'
+ warn 'e.g. fusuma-sendkey [A, B, C]'
exit 1
end
+
+# remove [ and ] from args
+params = args.delete('[]').split(',').map(&:strip)
+require 'debug'; debugger
+
keyboard = Fusuma::Plugin::Sendkey::Keyboard.new(name_pattern: device_name)
-keyboard.valid?(param: param) && keyboard.type(param: param)
+return unless keyboard.valid?(params)
+
+if params.size == 1
+ keyboard.type(param: params.first)
+else
+ keyboard.types(params)
+end