Sha256: dfb21e6e19afce9ae2cfb238968b18c771cd624dff44e38adb296a50765ea44b
Contents?: true
Size: 824 Bytes
Versions: 1
Compression:
Stored size: 824 Bytes
Contents
require 'optiflag' $log = "c:/log" # Example 2: Adding an optional flag and a usage flag module Example extend OptiFlag::Flagset flag "dir" optional_flag "log" flag "username" flag "password" usage_flag "h","help","?" handle_errors_and_help end if ARGV.flag_value.log? # note the question mark '?' $log = ARGV.flag_value.log puts "User input: #{ $log } for log via the command-line" else puts "User did NOT input log via the command-line" end #h# ruby example_2.rb --dir directory --username me --password fluffy #h# ruby example_2.rb --dir directory --username me --password fluffy --log c:/tmp/log # ruby example_2.rb -dir directory -username me -password fluffy -log c:/tmp/log #h# ruby example_2.rb -h #h# ruby example_2.rb -? # ruby example_2.rb -help
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
optiflag-0.6 | doc/example/example_2.rb |