Sha256: bf7e1e9cb3a2b7cd3074fc0986ba5768925e59e50adbe0e8693a9968e2965f81
Contents?: true
Size: 851 Bytes
Versions: 10
Compression:
Stored size: 851 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true # for dev purposes require 'bundler/setup' if ENV['HONEY_FORMAT_GEM_DEV'] require 'honey_format' require 'honey_format/cli/cli' cli = HoneyFormat::CLI.new options = cli.options input_path = options[:input_path] unless input_path puts cli.usage puts puts '[ERROR] input path required' exit 1 end csv_input = File.read(input_path) csv = HoneyFormat::CSV.new( csv_input, delimiter: options[:delimiter], type_map: options[:type_map], skip_lines: options[:skip_lines] ) csv_part = if options[:header_only] csv.header elsif options[:rows_only] csv.rows else csv end csv_string = csv_part.to_csv(columns: options[:columns]) if path = options[:output_path] File.write(path, csv_string) else puts csv_string end
Version data entries
10 entries across 10 versions & 1 rubygems