Sha256: 91dfeb083953d53d3f02497e8ef7c3b67a782b2ee8eedf6550d8583ed4e11760

Contents?: true

Size: 710 Bytes

Versions: 5

Compression:

Stored size: 710 Bytes

Contents

require 'yaml'

module Relish
  module Command
    class Help < Base
      class << self
        def for_command(command, help)
          command_help[command] = help
        end
        
        def command_help
          @command_help ||= {}
        end
      end
      
      def default
        puts "This is the prefunctory help message for the relish gem."

        puts "Commands:"
        Help.command_help.each do |command, help|
          message = "relish #{command}".ljust(max_command_length) + 
                    " # " + help
          puts message
        end
      end
      
      def max_command_length
        Help.command_help.keys.map { |c| c.to_s.length }.max
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
relish-0.0.8 lib/relish/commands/help.rb
relish-0.0.7 lib/relish/commands/help.rb
relish-0.0.6 lib/relish/commands/help.rb
relish-0.0.5 lib/relish/commands/help.rb
relish-0.0.4 lib/relish/commands/help.rb