lib/core/util/cli.rb in nucleon-0.1.3 vs lib/core/util/cli.rb in nucleon-0.1.4

- old
+ new

@@ -14,15 +14,15 @@ end #--- def self.encode(data) - Base64.encode64(Util::Data.to_json(data, false)) + Base64.urlsafe_encode64(Util::Data.to_json(data, false)) end def self.decode(encoded_string) - Util::Data.symbol_map(Util::Data.parse_json(Base64.decode64(encoded_string))) + Util::Data.symbol_map(Util::Data.parse_json(Base64.urlsafe_decode64(encoded_string))) end #------------------------------------------------------------------------- # Parser @@ -73,11 +73,11 @@ results = [ Parser.new(main_args, banner, separator, true) ] if sub_command results << [ sub_command, sub_args ] end - + return results.flatten end #--- @@ -128,18 +128,18 @@ else parser.on_tail('-h', '--help', CLI.message('nucleon.core.util.cli.options.short_help')) do options[:help] = true end end - parser.parse!(args) - # Now we can act on options given - Nucleon.log_level = options[:log_level] if options[:log_level] + # Now we can act on options given return if options[:help] parse_encoded + + Nucleon.log_level = options[:log_level] if options[:log_level] remaining_args = args.dup arg_messages = [] if arguments.empty? @@ -215,10 +215,10 @@ self.arguments[settings[:name]] = encoded_properties.delete(settings[:name].to_sym) end end encoded_properties.each do |name, value| - self.options[name] = value unless options.has_key?(name) + self.options[name] = value end end options.delete(:encoded_params) end