lib/sup/util/axe.rb (345B) - raw
1 require 'highline'
2 @cli = HighLine.new
3
4 def axe q, default=nil
5 question = if default && !default.empty?
6 "#{q} (enter for \"#{default}\"): "
7 else
8 "#{q}: "
9 end
10 ans = @cli.ask question
11 ans.empty? ? default : ans.to_s
12 end
13
14 def axe_yes q, default="n"
15 axe(q, default) =~ /^y|yes$/i
16 end
17