Sha256: ecbec86bc464f880c374ab4a4560e95fb6146a072c45c289de654f3765873f93
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
#!/usr/bin/env ruby require "../lib/como" include Como Spec.program( "Como Tester", "2013" ) do subcmd( "como_subcmd", [ [ :opt_single, "password", "-p", "User password." ], [ :opt_multi, "username", "-u", "Username(s)." ], [ :silent, "terminator","-", "Terminator." ], [ :subcmd, "add", nil, "Add file to repo." ], [ :subcmd, "rm", nil, "Remove file from repo." ], [ :subcmd, "commit", nil, "Commit (pending) changes to repo." ], ], ) checkRule do any( 'password', 'username' ) end subcmd( "add", [ [ :switch, "force", "-fo", "Force operation." ], [ :opt_single, "username", "-u", "Username." ], [ :single, "file", "-f", "File." ], ] ) checkRule do one( 'file', 'username', inv( '-fo' ) ) end subcmd( "rm", [ [ :switch, "force", "-fo", "Force operation." ], [ :opt_single, "file", "-f", "File." ], ] ) subcmd( "commit", [ [ :switch, "quiet", "-q", "Quiet operation." ], [ :opt_single, "username", "-u", "Username." ], [ :default, "File(s) to commit." ], ] ) end def displayOptions( opt ) puts "Options for: #{opt.name}" opt.each do |o| puts " Given \"#{o.name}\": #{o.given}" end opt.each_given do |o| puts " Value \"#{o.name}\": #{o.value}" end sub = opt.givenSubcmd displayOptions( sub ) if sub end displayOptions( Opt.main ) if Opt.external puts "External: #{Opt.external}" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
como-0.1.1 | test/como_subcmd |