Sha256: a1ae4b8bd53cddd4c53f4b1b64d0b43f86b6d9e1f9443b0db906005bbbfe716b
Contents?: true
Size: 863 Bytes
Versions: 1
Compression:
Stored size: 863 Bytes
Contents
require 'optiflag' # Example 1: Four required flags module Example extend OptiFlag::Flagset flag "dir" flag "log" flag "username" flag "password" end result = Example::parse(ARGV) if result.errors? result.errors.divulge_problems exit end # Some code to _use_ the values puts "User has input:#{ result.flag_value.dir } for dir" puts "User has input:#{ result.flag_value.log } for log" puts "User has input:#{ result.flag_value.username } for username" puts "User has input:#{ result.flag_value.password } for password" puts "The variable 'result' is actually just a copy of ARGV" puts "that has been extend to hold the return variables:" puts "See: #{ result.join(', ') }" # Try the following inputs # ruby example_1.rb #h# ruby example_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.rb |