Sha256: 58c54f54c5b60a0711963bc450fb04240d4abdcf2dd92ab0a849557949a9d4bf

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 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
      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

1 entries across 1 versions & 1 rubygems

Version Path
pkg-wizard-0.1.2 lib/pkg-wizard/command.rb