Method: EdifactConverter::CommandLineParser.parse

Defined in:
lib/edifact_converter/command_line_parser.rb

.parseObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/edifact_converter/command_line_parser.rb', line 52

def parse
  parser.parse!
  if ARGV.size != 1
    puts "Wrong number of arguments, run #{$COMMAND_NAME} -h for a list of possible arguments."
    exit
  end
  options[:input] = Pathname.new ARGV.first
  unless options[:source]
    if options[:input].extname =~ /xml/
      options[:source] = :xml
    else
      options[:source] = :edifact
    end
  end
  options
end