Sha256: 2e00122da05f9147bee5c57afea49bac965be7bc52c94f5f92c59129e29558cf
Contents?: true
Size: 896 Bytes
Versions: 1
Compression:
Stored size: 896 Bytes
Contents
require 'optiflag' # Example 1.1: # Variation 1: add a method 'handle_errors_and_help' to autoparse, check, and augment ARGV module Example extend OptiFlag::Flagset flag "dir" flag "log" flag "username" flag "password" handle_errors_and_help end # Some code to _use_ the values puts "User has input:#{ ARGV.flag_value.dir } for dir" puts "User has input:#{ ARGV.flag_value.log } for log" puts "User has input:#{ ARGV.flag_value.username } for username" puts "User has input:#{ ARGV.flag_value.password } for password" puts " The variable ARGV has been extend to hold the return variables." # Try the following inputs ## Breaks: #h# ruby example_1_1.rb ## Works: #h# ruby example_1_1.rb -log logdirectory -dir directory -username me -password fluffy # ruby example_1_1.rb --log logdirectory --dir directory --username me --password fluffy
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
optiflag-0.6 | doc/example/example_1_1.rb |