lib/rbbt/util/cmd.rb in rbbt-util-5.26.32 vs lib/rbbt/util/cmd.rb in rbbt-util-5.26.33
- old
+ new
@@ -11,13 +11,17 @@
def self.bash(cmd)
%Q(bash <<EOF\n#{cmd}\nEOF\n)
end
def self.process_cmd_options(options = {})
+ add_dashes = Misc.process_options options, :add_option_dashes
+
string = ""
options.each do |option, value|
raise "Invalid option key: #{option.inspect}" if option.to_s !~ /^[a-z_0-9\-=]+$/i
raise "Invalid option value: #{value.inspect}" if value.to_s.include? "'"
+
+ option = "--" << option.to_s if add_dashes and option.to_s[0] != '-'
case
when value.nil? || FalseClass === value
next
when TrueClass === value