Class: Envo::Cli::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/envo/cli/help.rb

Instance Method Summary collapse

Constructor Details

#initializeHelp

Returns a new instance of Help.



4
5
6
# File 'lib/envo/cli/help.rb', line 4

def initialize
  @commands = []
end

Instance Method Details

#add_cmd(usage, text) ⇒ Object



7
8
9
# File 'lib/envo/cli/help.rb', line 7

def add_cmd(usage, text)
  @commands << [usage, text]
end


10
11
12
13
14
15
16
17
# File 'lib/envo/cli/help.rb', line 10

def print(stream)
  @commands.each do |cmd|
    stream.puts "  * #{cmd[0]}"
    cmd[1].each_line do |line|
      stream.puts "        #{line}"
    end
  end
end