Module: R2CORBA::Commands
- Defined in:
- lib/corba/cmds/base.rb,
lib/corba/cmds/test.rb
Defined Under Namespace
Classes: Test
Constant Summary collapse
- @@commands =
Hash.new do |hash, key| $stderr.puts "Unknown command #{key} specified." exit(1) end
- @@options =
{ verbose: false }
Class Method Summary collapse
- .describe_all ⇒ Object
- .options ⇒ Object
- .parse_args(args) ⇒ Object
- .register(cmdid, cmdhandler) ⇒ Object
- .run(cmdid) ⇒ Object
Class Method Details
.describe_all ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/corba/cmds/base.rb', line 30 def self.describe_all puts 'R2CORBA commands:' puts "\tlist\t\tlist all r2corba commands" @@commands.each do |id, cmd| desc = cmd.description.split('\n') puts "\t#{id}\t\t#{desc.join('\t\t\t')}" end end |
.options ⇒ Object
43 44 45 |
# File 'lib/corba/cmds/base.rb', line 43 def self. @@options end |
.parse_args(args) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/corba/cmds/base.rb', line 47 def self.parse_args(args) opts = OptionParser.new opts. = "Usage: r2corba [global options] command [command options]\n\n" + " command\t\tSpecifies R2CORBA command to execute.\n" + " \t\tDefault = list :== list commands\n" opts.separator '' opts.on('-v', '--verbose', 'Show verbose output') { |v| ::R2CORBA::Commands.[:verbose] = true } opts.on('-h', '--help', 'Show this message.') { |v| puts opts; exit(0) } opts.parse!(args) end |
.register(cmdid, cmdhandler) ⇒ Object
26 27 28 |
# File 'lib/corba/cmds/base.rb', line 26 def self.register(cmdid, cmdhandler) @@commands[cmdid.to_s] = cmdhandler end |
.run(cmdid) ⇒ Object
39 40 41 |
# File 'lib/corba/cmds/base.rb', line 39 def self.run(cmdid) @@commands[cmdid.to_s].run end |