class Reline::Config

def inputrc_path

def inputrc_path
  case ENV['INPUTRC']
  when nil, ''
  else
    return File.expand_path(ENV['INPUTRC'])
  end
  # In the XDG Specification, if ~/.config/readline/inputrc exists, then
  # ~/.inputrc should not be read, but for compatibility with GNU Readline,
  # if ~/.inputrc exists, then it is given priority.
  home_rc_path = File.expand_path('~/.inputrc')
  return home_rc_path if File.exist?(home_rc_path)
  case path = ENV['XDG_CONFIG_HOME']
  when nil, ''
  else
    path = File.join(path, 'readline/inputrc')
    return path if File.exist?(path) and path == File.expand_path(path)
  end
  path = File.expand_path('~/.config/readline/inputrc')
  return path if File.exist?(path)
  return home_rc_path
end