Commit 75f3d7a63759ce785c155875e3bec2243caeccf2

Authored by Rodrigo Siqueira de Melo
1 parent 5e7a172c

Improved menu.

Showing 1 changed file with 13 additions and 7 deletions   Show diff stats
Vagrantfile
... ... @@ -9,22 +9,28 @@
9 9 default_box = "precise64"
10 10 if $stdin.isatty
11 11 if Dir.glob(File.join(File.dirname("__FILE__"), '.vagrant/**/id')).empty?
  12 + options = ["precise64", "trusty64", "chef/centos-7.0"]
  13 +
12 14 puts "Bases boxes available locally:"
13 15 puts '------------------------------'
14 16 system('vagrant', 'box', 'list')
15 17 puts
16 18 puts 'Base boxes we can provide you:'
17 19 puts '------------------------------'
18   - puts 'precise64 (virtualbox)'
19   - puts 'trusty64 (virtualbox)'
20   - puts 'chef/centos-7.0 (virtualbox)'
21   - puts
  20 + options.each_with_index do |value, i|
  21 + puts "[#{i + 1}] #{value}"
  22 + end
  23 +
22 24 print "Which box to use [#{default_box}]: "
23 25 choice = $stdin.gets.strip
24   - if !choice.empty?
25   - default_box = choice
  26 + options.each_with_index do |option, i|
  27 + if option == choice || choice.to_i == (i + 1)
  28 + default_box = option
  29 + puts default_box
  30 + break
  31 + end
26 32 end
27   - end
  33 + end
28 34 end
29 35  
30 36 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
... ...