1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

B #4075: add support for boolean inputs (#4120)

(cherry picked from commit 8c9b56bc29ef25e9398bd9f798261d80cc526982)
This commit is contained in:
Alejandro Huertas Herrero 2020-01-24 12:24:00 +01:00 committed by Ruben S. Montero
parent 0f428a7ec1
commit cdda2e6292
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -183,6 +183,20 @@ EOT
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