Skip to content

Commit 46f7e38

Browse files
John ButeJohn Bute
authored andcommitted
Consistency in y/n prompts #141 fix, where certain prompts would fail if the user gave 'Y' instead of 'y' to continue, now all prompting is consistent
1 parent b1deb64 commit 46f7e38

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Sources/Swiftly/Init.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ internal struct Init: SwiftlyCommand {
7777
\(installMsg)
7878
""")
7979

80-
if SwiftlyCore.readLine(prompt: "Proceed with the installation? [Y/n] ") == "n" {
80+
guard promptForConfirmation(defaultBehavior: true) else {
8181
throw SwiftlyError(message: "Swiftly installation has been cancelled")
8282
}
8383
}
@@ -93,9 +93,7 @@ internal struct Init: SwiftlyCommand {
9393
SwiftlyCore.print(" \(swiftlyBinDir.appendingPathComponent(executable).path)")
9494
}
9595

96-
let proceed = SwiftlyCore.readLine(prompt: "Proceed? [y/N]") ?? "n"
97-
98-
guard proceed == "y" else {
96+
guard promptForConfirmation(defaultBehavior: false) else {
9997
throw SwiftlyError(message: "Swiftly installation has been cancelled")
10098
}
10199
}

Sources/Swiftly/Install.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@ struct Install: SwiftlyCommand {
266266
SwiftlyCore.print(" \(swiftlyBinDir.appendingPathComponent(executable).path)")
267267
}
268268

269-
let proceed = SwiftlyCore.readLine(prompt: "Proceed? [y/N]") ?? "n"
270-
271-
guard proceed == "y" else {
269+
guard promptForConfirmation(defaultBehavior: false) else {
272270
throw SwiftlyError(message: "Toolchain installation has been cancelled")
273271
}
274272
}

0 commit comments

Comments
 (0)