Sha256: 7ef0dc1ab4124b52d2d9b47a6af355fe15cf39906d6d59a2fa36affde393a5ba

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

require 'optiflag'

# Example 7:  Character Flags
module HashAcess extend OptiFlag::Flagset

  character_flag :l, :list_group
  character_flag :s, :list_group
  character_flag :a, :list_group

  character_flag :x do
    description "Extract"
  end
  character_flag :v do
    description "Verbose"
  end
  character_flag :f do
    description "Archive File"
  end

  handle_errors_and_help
end 

f = ARGV.flag_value
puts "'l' flag set?: #{ f.l? }"
puts "'s' flag set?: #{ f.s? }"
puts "'a' flag set?: #{ f.a? }"
puts "'x' flag set?: #{ f.x? }"
puts "'f' flag set?: #{ f.f? }"
puts "'v' flag set?: #{ f.v? }"

#h# ruby example_7.rb -lsa
#h# ruby example_7.rb -ls -a
#h# ruby example_7.rb -a -s -l
#h# ruby example_7.rb -als -x -vf
#h# ruby example_7.rb -s -xvf
#h# ruby example_7.rb -lsaxvf



Version data entries

1 entries across 1 versions & 1 rubygems

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