Skip to content

Commit

Permalink
B #4075: add support for boolean inputs (#4120)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8c9b56b)
  • Loading branch information
Alejandro Huertas Herrero authored and rsmontero committed Jan 24, 2020
1 parent 0f428a7 commit cdda2e6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/cli/one_helper/onetemplate_helper.rb
Expand Up @@ -183,6 +183,20 @@ def self.get_user_inputs(template)
answer = Base64::encode64(answer).strip.delete("\n")
end

when 'boolean'
print header

answer = STDIN.readline.chop

# use default in case it's empty
answer = initial if answer.empty?

unless %w[YES NO].include?(answer)
STDERR.puts "Invalid boolean '#{answer}'"
STDERR.puts 'Boolean has to be YES or NO'
exit(-1)
end

when 'password'
print header

Expand Down

0 comments on commit cdda2e6

Please sign in to comment.