Sha256: 74a235e71ab1a63919eae2bc0ea00d125d49c1ffc5c337c7d856a4ec660e3845

Contents?: true

Size: 1014 Bytes

Versions: 4

Compression:

Stored size: 1014 Bytes

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'absa-h2h'
require 'absa-h2h/version'

options = {}

opt_parser = OptionParser.new do |opt|
  opt.banner = "Usage: opt_parser COMMAND [OPTIONS]"
  opt.separator  ""
  opt.separator  "Commands"
  opt.separator  "     absa-h2h input <FILENAME>"
  opt.separator  "     absa-h2h output <FILENAME>"
  opt.separator  ""
  opt.separator  "Options"

  opt.on("-h","--help","help") do
    puts opt_parser
  end
  
  opt.on("-v","--version","version") do
    puts Absa::H2h::VERSION
  end
end

opt_parser.parse!

case ARGV[0]
when "input"
  file = Dir.pwd + "/" + ARGV[1]
  file_contents = File.open(file, "rb").read
  options = Absa::H2h::Transmission::Document.hash_from_s(file_contents, 'input')
  puts options.to_yaml
when "output"
  file = Dir.pwd + "/" + ARGV[1]
  file_contents = File.open(file, "rb").read
  options = Absa::H2h::Transmission::Document.hash_from_s(file_contents, 'input')
  puts options.to_yaml
else
  puts "You need to specify input or output type"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
absa-h2h-0.1.5 bin/absa-h2h
absa-h2h-0.1.4 bin/absa-h2h
absa-h2h-0.1.3 bin/absa-h2h
absa-h2h-0.1.2 bin/absa-h2h