summaryrefslogtreecommitdiff
path: root/examples/getoptlong/permute.rb
diff options
context:
space:
mode:
authorBurdette Lamar <[email protected]>2022-05-02 11:03:26 -0500
committergit <[email protected]>2022-05-03 01:09:33 +0900
commit51ac3c9e80562a63bbab4b67be916a9f37b6e842 (patch)
treeb8612ab9e406c4dc30a4e3be8678bf7326b9845f /examples/getoptlong/permute.rb
parent8587bacc252e95e533d319cc58b58ec11e5561ff (diff)
[ruby/getoptlong] Enhanced RDoc for GetoptLong (https://github.com/ruby/getoptlong/pull/4)
Detailed introductory material. https://github.com/ruby/getoptlong/commit/1544f2fb7b
Diffstat (limited to 'examples/getoptlong/permute.rb')
-rw-r--r--examples/getoptlong/permute.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/getoptlong/permute.rb b/examples/getoptlong/permute.rb
new file mode 100644
index 0000000000..8efcad22ea
--- /dev/null
+++ b/examples/getoptlong/permute.rb
@@ -0,0 +1,12 @@
+require 'getoptlong'
+
+options = GetoptLong.new(
+ ['--xxx', GetoptLong::REQUIRED_ARGUMENT],
+ ['--yyy', GetoptLong::OPTIONAL_ARGUMENT],
+ ['--zzz', GetoptLong::NO_ARGUMENT]
+)
+puts "Original ARGV: #{ARGV}"
+options.each do |option, argument|
+ p [option, argument]
+end
+puts "Remaining ARGV: #{ARGV}"