require 'optiflag' # Example 1.2: # Variation 2: Changing the universal short-form default symbol from '-' to '/' module Example extend OptiFlag::Flagset(:flag_symbol => "/") 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" # Try the following inputs ## Breaks: # ruby example_1_2.rb #h# ruby example_1_2.rb -log logdirectory -dir directory -username me -password fluffy ## Works: #h# ruby example_1_2.rb /log logdirectory /dir directory /username me /password fluffy # ruby example_1_2.rb --log logdirectory --dir directory --username me --password fluffy #h# ruby example_1_2.rb --log logdirectory /dir directory --username me /password fluffy