Sha256: bc9ec60d111eb7f360e6f5a2df01f9d4a50b7906b3692a4dbe7abbba93c2b83d

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

#!/usr/bin/env ruby

# 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] || raise(ArgumentError, 'input path required')
csv_input = File.read(input_path)
csv = HoneyFormat::CSV.new(csv_input, delimiter: options[:delimiter])

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

2 entries across 2 versions & 1 rubygems

Version Path
honey_format-0.14.0 exe/honey_format
honey_format-0.13.0 exe/honey_format