summaryrefslogtreecommitdiff
path: root/sample/getoptlong/each.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/getoptlong/each.rb')
-rw-r--r--sample/getoptlong/each.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/sample/getoptlong/each.rb b/sample/getoptlong/each.rb
new file mode 100644
index 0000000000..661e0a968f
--- /dev/null
+++ b/sample/getoptlong/each.rb
@@ -0,0 +1,12 @@
+require 'getoptlong'
+
+options = GetoptLong.new(
+ ['--xxx', '-x', GetoptLong::REQUIRED_ARGUMENT],
+ ['--yyy', '-y', GetoptLong::OPTIONAL_ARGUMENT],
+ ['--zzz', '-z',GetoptLong::NO_ARGUMENT]
+)
+puts "Original ARGV: #{ARGV}"
+options.each do |option, argument|
+ p [option, argument]
+end
+puts "Remaining ARGV: #{ARGV}"