class Mixlib::ShellOut

def parse_options(opts)

def parse_options(opts)
  opts.each do |option, setting|
    case option.to_s
    when "cwd"
      self.cwd = setting
    when "domain"
      self.domain = setting
    when "password"
      self.password = setting
    when "user"
      self.user = setting
      self.with_logon = setting
    when "group"
      self.group = setting
    when "umask"
      self.umask = setting
    when "timeout"
      self.timeout = setting
    when "returns"
      self.valid_exit_codes = Array(setting)
    when "live_stream"
      self.live_stdout = self.live_stderr = setting
    when "live_stdout"
      self.live_stdout = setting
    when "live_stderr"
      self.live_stderr = setting
    when "input"
      self.input = setting
    when "logger"
      self.logger = setting
    when "log_level"
      self.log_level = setting
    when "log_tag"
      self.log_tag = setting
    when "environment", "env"
      if setting
        self.environment = Hash[setting.map { |(k, v)| [k.to_s, v] }]
      else
        self.environment = {}
      end
    when "login"
      self.login = setting
    when "elevated"
      self.elevated = setting
    when "sensitive"
      self.sensitive = setting
    else
      raise InvalidCommandOption, "option '#{option.inspect}' is not a valid option for #{self.class.name}"
    end
  end
  validate_options(opts)
end