Class: BzConsole::CommandTemplate
- Inherits:
-
Object
- Object
- BzConsole::CommandTemplate
- Includes:
- Bugzilla::Utils
- Defined in:
- lib/bzconsole/command_template.rb
Instance Attribute Summary collapse
-
#n_args ⇒ Object
readonly
def initialize.
Instance Method Summary collapse
-
#do(_argv) ⇒ Object
def parse.
-
#initialize(plugin) ⇒ CommandTemplate
constructor
A new instance of CommandTemplate.
- #parse(parser, argv, opts) ⇒ Object
Constructor Details
#initialize(plugin) ⇒ CommandTemplate
Returns a new instance of CommandTemplate.
4 5 6 7 8 |
# File 'lib/bzconsole/command_template.rb', line 4 def initialize(plugin) @n_args = 0 @defaultyamlfile = File.join(ENV['HOME'], '.bzconsole.yml') @plugin = plugin end |
Instance Attribute Details
#n_args ⇒ Object (readonly)
def initialize
10 11 12 |
# File 'lib/bzconsole/command_template.rb', line 10 def n_args @n_args end |
Instance Method Details
#do(_argv) ⇒ Object
def parse
23 24 25 |
# File 'lib/bzconsole/command_template.rb', line 23 def do(_argv) raise format('No implementation for %s', self.class) end |
#parse(parser, argv, opts) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bzconsole/command_template.rb', line 12 def parse(parser, argv, opts) raise format('No implementation for %s', self.class) if self.class =~ /CommandTemplate/ parser.on('-h', '--help', 'show this message') { |_x| opts[:help] = true } read_config(opts) @plugin.run(:parser, nil, parser, argv, opts) parser.order(argv) end |