lib/psychic/cli.rb in psychic-runner-0.0.7 vs lib/psychic/cli.rb in psychic-runner-0.0.8

- old
+ new

@@ -9,10 +9,17 @@ # Override Thor's start to strip extra_args from ARGV before it's processed attr_accessor :extra_args def start(given_args = ARGV, config = {}) if given_args && (split_pos = given_args.index('--')) - @extra_args = given_args.slice(split_pos + 1, given_args.length) + @extra_args = given_args.slice(split_pos + 1, given_args.length).map do | arg | + # Restore quotes + next unless arg.match(/\=/) + lhs, rhs = arg.split('=') + lhs = "\"#{lhs}\"" if lhs.match(/\s/) + rhs = "\"#{rhs}\"" if rhs.match(/\s/) + [lhs, rhs].join('=') + end given_args = given_args.slice(0, split_pos) end super given_args, config end end