Class: BzConsole::CommandTemplate

Inherits:
Object
  • Object
show all
Includes:
Bugzilla::Utils
Defined in:
lib/bzconsole/command_template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_argsObject (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