Method: DotFiles::DSL#command

Defined in:
lib/dot_files/dsl.rb

#command(command, options = {}, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/dot_files/dsl.rb', line 6

def command(command, options = {}, &block)
  @commands = Hash.new if @commands.nil?
  @commands[command] = Hash.new
  @commands[command][:description] = @next_description
  @commands[command][:usage] = @next_usage
  @commands[command][:flags] = @next_flags
  @commands[command][:required_args] = (options[:required_args] || 0)
  @commands[command][:block] = Command.new(block)
  @next_usage, @next_description, @next_flags = nil, nil, nil
end