Sha256: 6eba759989c475c588925df1cedcba975a3109bd1b3d7fbf38e338bac9a9d408

Contents?: true

Size: 447 Bytes

Versions: 19

Compression:

Stored size: 447 Bytes

Contents

#!/usr/bin/env ruby

require 'csv'
require 'shellwords'

prev_row = nil
begin
  CSV.open(ARGV[0], 'rb').each { |row| prev_row = row }
rescue CSV::MalformedCSVError => e
  puts e.class.to_s + ': ' + e.message
  puts "previous row was #{prev_row}"
  if e.message =~ /line (\d+)/
    lineno = $1.to_i
    cmd = "csv-readline #{Shellwords.escape(ARGV[0])} #{lineno}"
    puts "running #{cmd}"
    system(cmd)
  end
  exit 1
end

puts 'CSV file is ok'

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
csv-utils-0.3.24 bin/csv-find-error
csv-utils-0.3.23 bin/csv-find-error
csv-utils-0.3.22 bin/csv-find-error
csv-utils-0.3.21 bin/csv-find-error
csv-utils-0.3.20 bin/csv-find-error
csv-utils-0.3.19 bin/csv-find-error
csv-utils-0.3.18 bin/csv-find-error
csv-utils-0.3.17 bin/csv-find-error
csv-utils-0.3.16 bin/csv-find-error
csv-utils-0.3.15 bin/csv-find-error
csv-utils-0.3.14 bin/csv-find-error
csv-utils-0.3.13 bin/csv-find-error
csv-utils-0.3.12 bin/csv-find-error
csv-utils-0.3.11 bin/csv-find-error
csv-utils-0.3.10 bin/csv-find-error
csv-utils-0.3.9 bin/csv-find-error
csv-utils-0.3.8 bin/csv-find-error
csv-utils-0.3.7 bin/csv-find-error
csv-utils-0.3.6 bin/csv-find-error