Class: Blitz::Command::Help

Inherits:
Blitz::Command show all
Defined in:
lib/blitz/command/help.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Blitz::Command

Api

Instance Method Summary collapse

Methods included from Utils

#shift

Methods included from Helper

#ask, #error, #msg

Instance Method Details

#cmd_default(argv) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/blitz/command/help.rb', line 4

def cmd_default argv
    puts
    msg "Usage: blitz <command> <options>"
    helps = [
        { :cmd => 'help', :help => "Display this help" },
        { :cmd => 'account:about', :help => 'Show information about your account' },
        { :cmd => 'api:init', :help => 'Validate and login with your API key' },
        { :cmd => 'couch:fuzz', :help => 'Auto generate blitz tests from CouchDB' },
        { :cmd => 'curl', :help => 'Run a sprint or a rush' },
        { :cmd => 'curl:help', :help => 'Show help on sprint and rushing' },
        { :cmd => 'traceroute', :help => 'Run traceroute remotely' },
        { :cmd => 'traceroute:help', :help => 'Show help on traceroute' },
        { :cmd => 'version', :help => 'Show the version of this Ruby gem' }
    ]
    
    max_cmd_size = helps.inject(0) { |memo, obj| [ obj[:cmd].size, memo ].max } + 4
    helps.each do |h|
        msg "%*s - %s" % [max_cmd_size, h[:cmd], h[:help]]
    end
    puts
end