Sha256: e45c494caebcb19f78518fbdac975eb3ec18db86ba383e2d5256c307929994e9

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'optiflag'

# Example 2.2:  
#  Variation 2:  Adding descriptions to the flags (will appear in extended help)
### NOTE how 'description' can be nested in a block or used as a symbol key
module Example extend OptiFlag::Flagset
  flag "dir" do 
    description "The Appliction Directory"
  end
  optional_flag "log" do
    description "The directory in which to find the log files"
  end
  flag "username", :description => "Database username."  # alternate form
  flag "password" do
    description "Database password."
  end
  usage_flag "h","help","?"
  extended_help_flag "superhelp"

  handle_errors_and_help
end 

## Works (triggers extended help):
#   ruby example_2_2.rb -superhelp --dir directory --username me --password fluffy
#   ruby example_2_2.rb -superhelp --dir directory --username me --password fluffy
#   ruby example_2_2.rb -superhelp --dir directory --username me --password fluffy
#   ruby example_2_2.rb -superhelp --dir directory --username me
#   ruby example_2_2.rb -superhelp --dir directory
#   ruby example_2_2.rb -superhelp 
#h#   ruby example_2_2.rb --superhelp

Version data entries

1 entries across 1 versions & 1 rubygems

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