Sha256: 5852c2550ad23ca6fb07498bba88233204c36349f80aa5ca173628e46590643b

Contents?: true

Size: 992 Bytes

Versions: 1

Compression:

Stored size: 992 Bytes

Contents

#!/usr/bin/env ruby

require "../lib/como"
include Como

Spec.command( "como_queries", "Como Tester", "2013",
  [
    [ :exclusive, "doc", nil, "Documentation." ],
    [ :switch, "debug", nil, "Enable debugging." ],
    [ :opt_single, "mode", "-m", "Mode." ],
    [ :opt_multi, "params", nil, "Parameters." ],
    [ :opt_any, "types", "-t", "Types." ],
    [ :default, "Leftovers." ],
  ] )

Opt.each do |o|
    puts "Given \"#{o.name}\": #{o.given}"
end

Opt.each_given do |o|
    puts "Value \"#{o.name}\": #{o.value}"
end

Opt.main.suball do |o|
    puts "Name: #{o.name}"
    puts "  Value: #{~o}" if o.given
end

puts "Given count: #{Opt.main.givenCount}"

puts "Mode value: #{Opt[ 'mode' ].apply( "default mode" )}"

Opt[ 'debug' ].given? do
    puts "Debug option set."
end

Opt[ 'types' ].given do |value|
    puts "Types values: #{value}"
end

if Opt[:default].given
    puts "Default with \":default\": #{Opt[:default].value}"
    puts "Default with \"nil\": #{Opt[nil].value}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
como-0.1.1 test/como_queries