Sha256: 3dcd1e0b19d111e661b03d67992477d46e92d10b71c313283b1894108daca143

Contents?: true

Size: 701 Bytes

Versions: 4

Compression:

Stored size: 701 Bytes

Contents

#!/bin/env ruby

require "Getopt/Declare"


#  With the next specification, the <tt>-rev</tt> and/or <tt>-rand</tt> flags
#  can be specified _after_ the list of files, but still affect the processing
#  of those files. Moreover, if the command-line parsing fails for some reason
#  (perhaps due to an unrecognized argument), the deferred processing will
#  not be performed.
args = Getopt::Declare.new( %q{

  	<files>...	Files to be processed
  			    { defer { files.each { |i| 
                                                   puts i, " ",$ordered } } }

  	-rev[erse]	Process in reverse order
  			    { $ordered = -1; }

  	-rand[om]	Process in random order
  			    { $ordered = 0; }
  	} )

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
getopt-declare-1.13 samples/cmdline_defer.rb
getopt-declare-1.12 samples/cmdline_defer.rb
getopt-declare-1.21 samples/cmdline_defer.rb
getopt-declare-1.20 samples/cmdline_defer.rb