summaryrefslogtreecommitdiff
path: root/sample/getoptlong/return_in_order.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/getoptlong/return_in_order.rb')
-rw-r--r--sample/getoptlong/return_in_order.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/sample/getoptlong/return_in_order.rb b/sample/getoptlong/return_in_order.rb
new file mode 100644
index 0000000000..91ce1ef996
--- /dev/null
+++ b/sample/getoptlong/return_in_order.rb
@@ -0,0 +1,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}"