Sha256: 5582c908c4e1c49245eb842e2f63e062b98ed915fdfa01436b1dfd26ae33d68d

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

require 'yaml'

module Relish
  module Command
    class Help < Base
      
      desc    'show this usage'
      command :default do
        puts "=== Available Commands\n\n"

        Dsl::HelpText.commands.each do |command, list|
          list.each do |hash|
            usage, description = *hash.to_a.flatten
            usage = command if usage == 'default'
            puts "#{usage.ljust(max_command_length)} # #{description}"
          end
        end
      end
      
    private
      
      def max_command_length
        Dsl::HelpText.commands.values.map {|v|
          v.map {|v| v.keys.to_s.length }.max
        }.max
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
relish-0.0.9 lib/relish/commands/help.rb