Skip to content

Commit

Permalink
Require a non empty input
Browse files Browse the repository at this point in the history
  • Loading branch information
vitobotta committed Feb 3, 2025
1 parent 0d40d5f commit f4454de
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/cluster/delete.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@ class Cluster::Delete

def run
unless force
print "Please enter the cluster name to confirm that you want to delete it: "
input = gets
input = nil
loop do
print "Please enter the cluster name to confirm that you want to delete it: "
input = gets.try(&.strip)

if input.nil? || input.empty?
puts "\nError: Input cannot be empty. Please enter the cluster name.".colorize(:red)
next
end
break
end

if input.try(&.strip) != settings.cluster_name
puts
Expand Down

0 comments on commit f4454de

Please sign in to comment.