Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Keep what you switch on while zsh answers the Shell tab
Țugui Dragoșa56d4d245637
diff --git a/Peel/Model/ShellLibrary.swift b/Peel/Model/ShellLibrary.swiftindex c8e4dcf0..48a6d918 100644--- a/Peel/Model/ShellLibrary.swift+++ b/Peel/Model/ShellLibrary.swift@@ -47,13 +47,14 @@ final class ShellLibrary {}let shell = ShellSessions.inTerminal(terminal, home: home)let startupFile = await shell?.zshrc(home: home)- let choices = ShellFile.read(file)let isSourced = startupFile.map { ShellFile.isSourced(file, from: $0, home: home) } ?? false- let shownPrompt: ShellSessions.ShownPrompt? = if choices?.prompt != nil, isSourced {+ let shownPrompt: ShellSessions.ShownPrompt? = if ShellFile.read(file)?.prompt != nil, isSourced {await shell?.promptShown(home: home)} else {nil}+ // Read after zsh answered, which takes as long as the person's startup files: a switch can change it meanwhile.+ let choices = ShellFile.read(file)state = State(shell: shell,startupFile: startupFile,diff --git a/PeelTests/TerminalLibrariesTests.swift b/PeelTests/TerminalLibrariesTests.swiftindex bb02d7f5..e8b4c213 100644--- a/PeelTests/TerminalLibrariesTests.swift+++ b/PeelTests/TerminalLibrariesTests.swift@@ -96,6 +96,29 @@ struct TerminalLibrariesTests {#expect(library.state?.shownPrompt?.prompt == "mine> ")}+ @Test func aSwitchTurnedOnWhileZshAnswersStaysOn() async throws {+ let home = try madeUpHome()+ defer { try? FileManager.default.removeItem(at: home) }+ let folder = home.appending(path: "Library/Application Support/Peel", directoryHint: .isDirectory)+ let terminal = FakeTerminalSettings()+ terminal.shellSetting = "/bin/zsh"+ let library = ShellLibrary(folder: folder, home: home, terminal: terminal)+ try ("sleep 3\n" + library.line + "\n")+ .write(to: home.appending(path: ".zshrc"), atomically: true, encoding: .utf8)+ try "export ZDOTDIR=\"$HOME\"\n".write(to: home.appending(path: ".zshenv"), atomically: true, encoding: .utf8)+ await library.refresh()+ library.setPrompt(Prompt())++ let reading = Task { await library.refresh() }+ try await Task.sleep(for: .seconds(1))+ library.set(.autoCD, to: true)+ await reading.value++ #expect(library.state?.choices?.settings.contains(.autoCD) == true)+ library.set(.comments, to: true)+ #expect(ShellFile.read(library.file)?.settings == [.autoCD, .comments])+ }+@Test func theShellTabLooksForNoZshrcWhenTerminalOpensBash() async throws {let home = try madeUpHome()defer { try? FileManager.default.removeItem(at: home) }