Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Sources/Swiftly/Init.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ internal struct Init: SwiftlyCommand {
These locations can be changed with SWIFTLY_HOME and SWIFTLY_BIN environment variables and run this again.
\(installMsg)
""")

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

let proceed = SwiftlyCore.readLine(prompt: "Proceed? [y/N]") ?? "n"

guard proceed == "y" else {
guard SwiftlyCore.promptForConfirmation(defaultBehavior: false) else {
throw SwiftlyError(message: "Swiftly installation has been cancelled")
}
}
Expand Down Expand Up @@ -203,8 +200,12 @@ internal struct Init: SwiftlyCommand {
try FileManager.default.createDirectory(at: confDir, withIntermediateDirectories: true)
profileHome = confDir.appendingPathComponent("swiftly.fish", isDirectory: false)
} else {
let confDir = userHome.appendingPathComponent(".config/fish/conf.d", isDirectory: true)
try FileManager.default.createDirectory(at: confDir, withIntermediateDirectories: true)
let confDir = userHome.appendingPathComponent(
".config/fish/conf.d", isDirectory: true
)
try FileManager.default.createDirectory(
at: confDir, withIntermediateDirectories: true
)
profileHome = confDir.appendingPathComponent("swiftly.fish", isDirectory: false)
}
} else {
Expand Down
4 changes: 1 addition & 3 deletions Sources/Swiftly/Install.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,7 @@ struct Install: SwiftlyCommand {
SwiftlyCore.print(" \(swiftlyBinDir.appendingPathComponent(executable).path)")
}

let proceed = SwiftlyCore.readLine(prompt: "Proceed? [y/N]") ?? "n"

guard proceed == "y" else {
guard SwiftlyCore.promptForConfirmation(defaultBehavior: false) else {
throw SwiftlyError(message: "Toolchain installation has been cancelled")
}
}
Expand Down