Skip to content

Commit 988e0f1

Browse files
feat: if verbose notify shell profile was updated
1 parent 823de2f commit 988e0f1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sources/Swiftly/SelfUninstall.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct SelfUninstall: SwiftlyCommand {
4545
try await Self.execute(ctx, verbose: self.root.verbose)
4646
}
4747

48-
static func execute(_ ctx: SwiftlyCoreContext, verbose _: Bool) async throws {
48+
static func execute(_ ctx: SwiftlyCoreContext, verbose: Bool) async throws {
4949
await ctx.print("Uninstalling swiftly...")
5050

5151
let userHome = ctx.mockedHomeDir ?? fs.home
@@ -82,13 +82,18 @@ struct SelfUninstall: SwiftlyCommand {
8282

8383
// Remove swiftly source lines from shell profiles
8484
for path in profilePaths where try await fs.exists(atPath: path) {
85-
await ctx.print("Updating \(path)...")
85+
if verbose {
86+
await ctx.print("Checking \(path)...")
87+
}
8688
let isFish = path.extension == "fish"
8789
let sourceLine = isFish ? fishSourceLine : shSourceLine
8890
let contents = try String(contentsOf: path, encoding: .utf8)
8991
if contents.contains(sourceLine) {
9092
let updated = contents.replacingOccurrences(of: sourceLine, with: "")
9193
try Data(updated.utf8).write(to: path, options: [.atomic])
94+
if verbose {
95+
await ctx.print("\(path) was updated to remove swiftly source line.")
96+
}
9297
}
9398
}
9499

0 commit comments

Comments
 (0)