lib/sifttter_redux/cli_message.rb in sifttter-redux-0.4.0 vs lib/sifttter_redux/cli_message.rb in sifttter-redux-0.4.1
- old
+ new
@@ -68,17 +68,20 @@
# returns it.
# @param prompt The prompt to output
# @param default The default option
# @return String
# ----------------------------------------------------
- def self.prompt(prompt, default)
- print "#{ prompt } [default: #{ default }]: "
+ def self.prompt(prompt, default = nil, log = true)
+ print "#{ prompt } #{ default.nil? ? '' : "[default: #{ default }]:" } ".blue
choice = $stdin.gets.chomp
if choice.empty?
- return default
+ r = default
else
- return choice
+ r = choice
end
+
+ Methadone::CLILogging.info("Answer to '#{ prompt }': #{r}") if log
+ r
end
# ----------------------------------------------------
# section method
#