Class: Muwu::Cli

Inherits:
Object
  • Object
show all
Includes:
Muwu
Defined in:
lib/muwu/cli/cli.rb

Constant Summary

Constants included from Muwu

GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION

Instance Method Summary collapse

Methods included from Muwu

debug, read

Constructor Details

#initialize(args) ⇒ Cli

Returns a new instance of Cli.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/muwu/cli/cli.rb', line 8

def initialize(args)
  @args = args.map do |a|
    case a
    when nil
      nil
    else
      a.downcase.strip
    end
  end
  
  @current_working_directory = Dir.pwd
end

Instance Method Details

#evaluate_argumentsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/muwu/cli/cli.rb', line 26

def evaluate_arguments
  if @args == []
    puts CliHelp.new(:summary).message
  elsif @args != []
    case @args[0]
    when 'compile'
      evaluate_command_compile
    when 'concat'
      evaluate_command_concat
    when 'help'
      evaluate_command_help
    when 'inspect'
      evaluate_command_inspect
    when 'new'
      evaluate_command_new
    when 'reset'
      evaluate_command_reset
    when '--version'
      puts VERSION
    else
      puts CliHelp.new(:summary).message
    end
  end
end