Sha256: 7c332674115a8d562752c918b765d79a03b74cdbe02518656edc1e073b31fb81
Contents?: true
Size: 987 Bytes
Versions: 11
Compression:
Stored size: 987 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}" puts "Value \"#{o.name}\": #{o.value}" if o.given && 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
11 entries across 11 versions & 1 rubygems