Sha256: d07caecd152e8cdcb6731930c38e780c0863bd62fc1e1359e7a430ed4f24ec52

Contents?: true

Size: 715 Bytes

Versions: 14

Compression:

Stored size: 715 Bytes

Contents

#!/bin/env ruby

require "Getopt/Declare"

argv2 = '-in test'

# Parse options from another string instead of ARGV
args = Getopt::Declare.new(<<'EOPARAM', argv2 )

   ============================================================
   -in <infile>		Input file
   -r[and[om]]		Output in random order
   -p[erm[ute]]		Output all permutations
   -out <outfile>	Optional output file
   ============================================================
EOPARAM

puts args.inspect

# Parse options from another string instead of ARGV
argv3 = "-r -in argv3"
args.parse(argv3)
puts args.inspect

# Parse options from another array instead of ARGV
argv4 = [ '-in', 'opt with spaces' ]

args.parse(['-ARGV', argv4])
puts args.inspect

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
getopt-declare-1.32 samples/cmdline_noargv.rb
getopt-declare-1.31 samples/cmdline_noargv.rb
getopt-declare-1.30 samples/cmdline_noargv.rb
getopt-declare-1.29 samples/cmdline_noargv.rb
getopt-declare-1.13 samples/cmdline_noargv.rb
getopt-declare-1.25 samples/cmdline_noargv.rb
getopt-declare-1.28 samples/cmdline_noargv.rb
getopt-declare-1.12 samples/cmdline_noargv.rb
getopt-declare-1.22 samples/cmdline_noargv.rb
getopt-declare-1.27 samples/cmdline_noargv.rb
getopt-declare-1.20 samples/cmdline_noargv.rb
getopt-declare-1.21 samples/cmdline_noargv.rb
getopt-declare-1.26 samples/cmdline_noargv.rb
getopt-declare-1.23 samples/cmdline_noargv.rb