Skip to content

Commit

Permalink
improvement: Yn -> y/n to represent a lack of a default
Browse files Browse the repository at this point in the history
closes #91
  • Loading branch information
zachdaniel committed Sep 25, 2024
1 parent dee8e15 commit f7c66ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/igniter/util/io.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ defmodule Igniter.Util.IO do

@doc "Prompts the user for yes or no, repeating the prompt until a satisfactory answer is given"
def yes?(prompt) do
case String.trim(Mix.shell().prompt(prompt <> " [Yn]")) do
case String.trim(Mix.shell().prompt(prompt <> " [y/n]")) do
yes when yes in ["y", "Y", "yes", "YES"] ->
true

no when no in ["n", "N", "no", "NO"] ->
false

value ->
Mix.shell().info("Please enter one of [Yn]. Got: #{value}")
Mix.shell().info("Please enter one of [y/n]. Got: #{value}")
yes?(prompt)
end
end
Expand Down

0 comments on commit f7c66ff

Please sign in to comment.