lib/scripto/csv_commands.rb
def csv_write(path, rows, cols: nil)
      atomic_write(path) do |tmp|
        CSV.open(tmp.path, "wb") { |f| csv_write0(f, rows, cols: cols) }
      end
    end
def csv_write(path, rows, cols: nil)
      atomic_write(path) do |tmp|
        CSV.open(tmp.path, "wb") { |f| csv_write0(f, rows, cols: cols) }
      end
    end
Write +rows+ to +path+ as csv. Rows can be an array of hashes, Structs,
 OpenStructs, or anything else that responds to to_h. The keys from the
 first row are used as the csv header. If +cols+ is specified, it will be
 used as the column keys instead.