Sha256: 92b6c409d88ce13f6c32e0c81817f1526bb7425b5c9450e2766162a2a3a28e47

Contents?: true

Size: 502 Bytes

Versions: 1

Compression:

Stored size: 502 Bytes

Contents

require 'optiflag'

# Example 2.6: 
# Variation 6:  Using the optional switch flag, a zero argument optional flag
module Example extend OptiFlag::Flagset
  flag "dir"
  optional_switch_flag "clear"

  handle_errors_and_help
end 



flag = ARGV.flag_value
if flag.clear?
  puts "The optional switch flag -clear has been invoked"
else
  puts "The optional switch flag -clear was NOT invoked"
end

#h#   ruby example_2_6.rb -dir c:/dir 
#h#   ruby example_2_6.rb -clear -dir c:/dir 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
optiflag-0.6 doc/example/example_2_6.rb