class Rails::Command::ServerCommand

def user_supplied_options

def user_supplied_options
  @user_supplied_options ||= begin
    # Convert incoming options array to a hash of flags
    #   ["-p3001", "-C", "--binding", "127.0.0.1"] # => {"-p"=>true, "-C"=>true, "--binding"=>true}
    user_flag = {}
    @original_options.each do |command|
      if command.start_with?("--")
        option = command.split("=")[0]
        user_flag[option] = true
      elsif command =~ /\A(-.)/
        user_flag[Regexp.last_match[0]] = true
      end
    end
    # Collect all options that the user has explicitly defined so we can
    # differentiate them from defaults
    user_supplied_options = []
    self.class.class_options.select do |key, option|
      if option.aliases.any? { |name| user_flag[name] } || user_flag["--#{option.name}"]
        name = option.name.to_sym
        case name
        when :port
          name = :Port
        when :binding
          name = :Host
        when :dev_caching
          name = :caching
        when :daemonize
          name = :daemon
        end
        user_supplied_options << name
      end
    end
    user_supplied_options << :Host if ENV["HOST"] || ENV["BINDING"]
    user_supplied_options << :Port if ENV["PORT"]
    user_supplied_options << :pid if ENV["PIDFILE"]
    user_supplied_options.uniq
  end
end