class MiniPortile

def tar_command(file, target)

def tar_command(file, target)
  case File.extname(file)
    when '.gz', '.tgz'
      [tar_exe, 'xzf', file, '-C', target]
    when '.bz2', '.tbz2'
      [tar_exe, 'xjf', file, '-C', target]
    when '.xz'
      # NOTE: OpenBSD's tar command does not support the -J option
      "#{xzcat_exe.shellescape} #{file.shellescape} | #{tar_exe.shellescape} xf - -C #{target.shellescape}"
    else
      [tar_exe, 'xf', file, '-C', target]
  end
end