Sha256: f2a141c10dd4b3214437c9664c0a0f0131030726330ffa1a4fae866a3affbce5
Contents?: true
Size: 1.61 KB
Versions: 10
Compression:
Stored size: 1.61 KB
Contents
#!/usr/bin/env ruby require "../lib/como" include Como Spec.program( "Como Tester", "2013" ) do command( "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." ], ] ) check 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}" puts " Value \"#{o.name}\": #{o.value}" if o.given && 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
10 entries across 10 versions & 1 rubygems