Class: Sanctuary::CLI

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

Class Method Summary collapse

Class Method Details

.startObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sanctuary/cli.rb', line 8

def self.start
  if ARGV.include?("-m")
    results = multi_select
    results.each do |result|
      Generator.start([result[1..-1], '', ''])
    end
  elsif ARGV.include?("--recipe")
    result = present_recipe_choices
    Generator.start([result[1..-1], '', 'recipe'])
  elsif ARGV.include?("--script")
    result = present_script_choices
    Generator.start([result[1..-1], ARGV.last, 'script'])
  elsif ARGV.include?("--save-recipe")
    RecipeGenerator.generate_recipe
  else
    result = present_choices
    if ARGV.include?("-p")
      Generator.start([result[1..-1], ARGV.last, ''])
    elsif ARGV.include?("--file")
      Generator.start([result[1..-1], '', ''])
    end
  end
end