Sha256: d50af871b22e77a912448dffd5a07f97bf3db2e34c1b90e910a86e48598c0667

Contents?: true

Size: 935 Bytes

Versions: 22

Compression:

Stored size: 935 Bytes

Contents

module PKGWizard
  class Command
    include ::Mixlib::CLI

    option :help,
      :short => "-h",
      :long => "--help",
      :description => "Show this message",
      :on => :tail,
      :boolean => true,
      :show_options => true,
      :exit => 0 

    def self.registry
      @@registry ||= []
    end

    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

  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pkg-wizard-0.1.29 lib/pkg-wizard/command.rb
pkg-wizard-0.1.28 lib/pkg-wizard/command.rb
pkg-wizard-0.1.27 lib/pkg-wizard/command.rb
pkg-wizard-0.1.26 lib/pkg-wizard/command.rb
pkg-wizard-0.1.25 lib/pkg-wizard/command.rb
pkg-wizard-0.1.24 lib/pkg-wizard/command.rb
pkg-wizard-0.1.23 lib/pkg-wizard/command.rb
pkg-wizard-0.1.22 lib/pkg-wizard/command.rb
pkg-wizard-0.1.21 lib/pkg-wizard/command.rb
pkg-wizard-0.1.19 lib/pkg-wizard/command.rb
pkg-wizard-0.1.18 lib/pkg-wizard/command.rb
pkg-wizard-0.1.17 lib/pkg-wizard/command.rb
pkg-wizard-0.1.16 lib/pkg-wizard/command.rb
pkg-wizard-0.1.15 lib/pkg-wizard/command.rb
pkg-wizard-0.1.14 lib/pkg-wizard/command.rb
pkg-wizard-0.1.12 lib/pkg-wizard/command.rb
pkg-wizard-0.1.10 lib/pkg-wizard/command.rb
pkg-wizard-0.1.8 lib/pkg-wizard/command.rb
pkg-wizard-0.1.7 lib/pkg-wizard/command.rb
pkg-wizard-0.1.6 lib/pkg-wizard/command.rb