Class: PKGWizard::Command
- Inherits:
-
Object
- Object
- PKGWizard::Command
show all
- Includes:
- Mixlib::CLI
- Defined in:
- lib/pkg-wizard/command.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.registry ⇒ Object
14
15
16
|
# File 'lib/pkg-wizard/command.rb', line 14
def self.registry
@@registry ||= []
end
|
Instance Method Details
#run(argv) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/pkg-wizard/command.rb', line 18
def run(argv)
@@argv = argv
if @@argv.include?('--version') or @@argv.include?('-v')
puts "PKG Wizard Version #{PKGWizard::VERSION}"
exit 0
end
cmd = argv.shift
found = false
@@registry.each do |c|
if c[:name] == cmd
c[:klass].perform
found = true
end
end
if not found
puts
puts "USAGE: #{File.basename($0)} command [options]"
puts
puts "Available Commands:"
puts
@@registry.each do |c|
puts c[:name]
end
puts
end
end
|