summaryrefslogtreecommitdiff
path: root/sample/getoptlong/return_in_order.rb
blob: 91ce1ef9963d1230735024f68b7c16b028259f57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'getoptlong'

options = GetoptLong.new(
  ['--xxx', GetoptLong::REQUIRED_ARGUMENT],
  ['--yyy', GetoptLong::OPTIONAL_ARGUMENT],
  ['--zzz', GetoptLong::NO_ARGUMENT]
)
options.ordering = GetoptLong::RETURN_IN_ORDER
puts "Original ARGV: #{ARGV}"
options.each do |option, argument|
  p [option, argument]
end
puts "Remaining ARGV: #{ARGV}"