Class: BunBun::CLI::Command
- Inherits:
-
Object
- Object
- BunBun::CLI::Command
show all
- Defined in:
- lib/bunbun/cli/command.rb
Direct Known Subclasses
Countries, Keys, Purge, Regions, StorageCommand, StorageZone, StorageZoneCreate, StorageZones, Zone, ZoneCreate, ZonePurge, ZoneRulesDelete, ZoneRulesDisenable, ZoneRulesEnable, ZoneRulesPost, Zones
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
31
32
33
|
# File 'lib/bunbun/cli/command.rb', line 31
def options
@options
end
|
Class Method Details
.argument_count ⇒ Object
19
20
21
|
# File 'lib/bunbun/cli/command.rb', line 19
def self.argument_count
argument_names.length
end
|
.argument_names ⇒ Object
15
16
17
|
# File 'lib/bunbun/cli/command.rb', line 15
def self.argument_names
@argument_names ||= instance_method(:call).parameters.select { _1[0] == :req || _1[0] == :opt }.map { _1[1] }
end
|
.option(name) ⇒ Object
11
12
13
|
# File 'lib/bunbun/cli/command.rb', line 11
def self.option(name)
options << name
end
|
.options ⇒ Object
7
8
9
|
# File 'lib/bunbun/cli/command.rb', line 7
def self.options
@options ||= []
end
|
Instance Method Details
#call ⇒ Object
33
34
|
# File 'lib/bunbun/cli/command.rb', line 33
def call
end
|
#option_parser ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/bunbun/cli/command.rb', line 23
def option_parser
OptionParser.new do |opts|
self.class.options.each do |name|
opts.on("--#{name}=VALUE")
end
end
end
|