summaryrefslogtreecommitdiff
path: root/sample/getoptlong/require_order.rb
blob: 357f667905755ea9f2950d5fabc1c9e5ed9ee2f9 (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::REQUIRE_ORDER
puts "Original ARGV: #{ARGV}"
options.each do |option, argument|
  p [option, argument]
end
puts "Remaining ARGV: #{ARGV}"