Skip to content
This repository
tree: e64819092c
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 33 lines (30 sloc) 0.826 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
module Couchup
  module Commands
    class Help
      def run(param = nil)
        param.nil? ? show_all : show(param.camelize)
        nil
      end
      def show(command)
        k = Commands.const_get(command.to_s)
        ap k.describe
      end
      
      def show_all
        Commands.constants.each do |stuff|
          k = Commands.const_get(stuff)
          print stuff.underscore
          print (stuff.underscore.size > 10) ? "\t" : "\t\t"
          ap k.respond_to?(:describe) ? k.describe[:description] : "No Help"
        end
        ap "Type help <command> for more detailed info"
      end
    
      def self.describe
       {
         :description => "Help on the system",
         :usage => "help [<command>]",
         :examples => ["help", "help :get"]
       }
        
      end
    end
  end
end
Something went wrong with that request. Please try again.