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
Say when Peel's own file couldn't be read, or zsh, ssh or Git didn't answer
Țugui Dragoș3844b60a023f
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex df5cf843..dd533664 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -46336,6 +46336,112 @@}}},+ "Git didn’t answer" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git neodpověděl"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git hat nicht geantwortet"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git no ha respondido"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git n’a pas répondu"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git non ha risposto"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Gitから応答がありませんでした"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git이 응답하지 않음"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git gaf geen antwoord"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git nie odpowiedział"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Git não respondeu"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git nu a răspuns"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git не ответил"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git svarade inte"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git yanıt vermedi"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git не відповів"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git没有回应"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Git沒有回應"+ }+ }+ }+ },"Git isn’t installed" : {"localizations" : {"cs" : {@@ -120707,6 +120813,112 @@}}},+ "Peel’s settings file couldn’t be read" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Soubor nastavení Peelu nelze přečíst"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Die Einstellungsdatei von Peel konnte nicht gelesen werden"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "No se ha podido leer el archivo de ajustes de Peel"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Impossible de lire le fichier de réglages de Peel"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Impossibile leggere il file delle impostazioni di Peel"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peelの設定ファイルを読み取れませんでした"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel 설정 파일을 읽을 수 없음"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Het instellingenbestand van Peel kon niet worden gelezen"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nie udało się odczytać pliku ustawień Peel"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Não foi possível ler o arquivo de ajustes do Peel"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Fișierul de configurare Peel nu a putut fi citit"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не удалось прочитать файл настроек Peel"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peels inställningsfil kunde inte läsas"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel’in ayar dosyası okunamadı"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не вдалося прочитати файл налаштувань Peel"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未能读取Peel的设置文件"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "無法讀取Peel的設定檔"+ }+ }+ }+ },"Personalized Smart Replies in Mail" : {"localizations" : {"cs" : {@@ -210890,6 +211102,112 @@}}},+ "ssh didn’t answer" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh neodpověděl"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh hat nicht geantwortet"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh no ha respondido"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh n’a pas répondu"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh non ha risposto"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "sshから応答がありませんでした"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh가 응답하지 않음"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh gaf geen antwoord"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh nie odpowiedział"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O ssh não respondeu"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh nu a răspuns"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh не ответил"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh svarade inte"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh yanıt vermedi"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh не відповів"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh没有回应"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ssh沒有回應"+ }+ }+ }+ },"ssh doesn’t read Peel’s settings yet" : {"localizations" : {"cs" : {@@ -211420,6 +211738,112 @@}}},+ "zsh didn’t answer" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh neodpověděl"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh hat nicht geantwortet"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh no ha respondido"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh n’a pas répondu"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh non ha risposto"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zshから応答がありませんでした"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh가 응답하지 않음"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh gaf geen antwoord"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh nie odpowiedział"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O zsh não respondeu"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh nu a răspuns"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh не ответил"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh svarade inte"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh yanıt vermedi"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh не відповів"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh没有回应"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "zsh沒有回應"+ }+ }+ }+ },"zsh doesn’t read Peel’s settings yet" : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCore/Terminal/SSHFile.swift b/Packages/PeelCore/Sources/PeelCore/Terminal/SSHFile.swiftindex df003e6d..3a312470 100644--- a/Packages/PeelCore/Sources/PeelCore/Terminal/SSHFile.swift+++ b/Packages/PeelCore/Sources/PeelCore/Terminal/SSHFile.swift@@ -91,16 +91,20 @@ public enum SSHFile {}}- /// The settings the ssh on this Mac accepts, asked on its command line so nothing is written to try them.- public static func accepted() async -> Set<SSHSetting> {+ /// The settings the ssh on this Mac accepts, asked on its command line so nothing is written to try them, or nil+ /// when ssh answered none of the questions.+ public static func accepted(ssh: String = "/usr/bin/ssh") async -> Set<SSHSetting>? {var accepted: Set<SSHSetting> = []+ var answered = falsefor setting in SSHSetting.allCases {let options = setting.lines.flatMap { ["-o", $0] }- let answer = await Subprocess.run("/usr/bin/ssh", ["-G", "-F", "/dev/null"] + options + ["peel.invalid"], environment: [:], timeout: 10)- if case .success(let output) = answer, output.status == 0 {+ let answer = await Subprocess.run(ssh, ["-G", "-F", "/dev/null"] + options + ["peel.invalid"], environment: [:], timeout: 10)+ guard case .success(let output) = answer else { continue }+ answered = true+ if output.status == 0 {accepted.insert(setting)}}- return accepted+ return answered ? accepted : nil}}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SSHFileTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SSHFileTests.swiftindex 48636b1d..375a3043 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SSHFileTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SSHFileTests.swift@@ -66,6 +66,12 @@ struct SSHFileTests {#expect(await SSHFile.accepted() == Set(SSHSetting.allCases))}+ @Test func anSSHThatDoesNotAnswerLeavesWhatItAcceptsUnknown() async {+ #expect(await SSHFile.accepted(ssh: "/usr/bin/true") == Set(SSHSetting.allCases))+ #expect(await SSHFile.accepted(ssh: "/usr/bin/false") == [])+ #expect(await SSHFile.accepted(ssh: "/usr/bin/peel-no-such-ssh") == nil)+ }+/// Another ssh, such as Homebrew's, doesn't know `UseKeychain`: renamed to an option the ssh on this Mac doesn't/// know either, Peel's file has to be read all the same.@Test func anSSHThatDoesNotKnowAnOptionStillReadsTheFile() async throws {diff --git a/Peel/Model/SSHLibrary.swift b/Peel/Model/SSHLibrary.swiftindex ac9d5f83..31e7b866 100644--- a/Peel/Model/SSHLibrary.swift+++ b/Peel/Model/SSHLibrary.swift@@ -7,7 +7,8 @@ final class SSHLibrary {struct State: Equatable {var settings: Set<SSHSetting>?var isIncluded: Bool- var accepted: Set<SSHSetting>+ /// What the ssh on this Mac accepts, nil while it has not answered.+ var accepted: Set<SSHSetting>?}let file: URL@@ -33,7 +34,7 @@ final class SSHLibrary {}func refresh() async {- let accepted = if let state, !state.accepted.isEmpty { state.accepted } else { await SSHFile.accepted() }+ let accepted = if let accepted = state?.accepted { accepted } else { await SSHFile.accepted() }state = State(settings: SSHFile.read(file),isIncluded: SSHFile.isIncluded(file, from: config, home: home),@@ -43,7 +44,7 @@ final class SSHLibrary {func isOffered(_ setting: SSHSetting) -> Bool {guard let state, state.settings != nil else { return false }- return state.accepted.contains(setting)+ return state.accepted?.contains(setting) == true}func set(_ setting: SSHSetting, to isOn: Bool) {diff --git a/Peel/Views/Terminal/GitTab.swift b/Peel/Views/Terminal/GitTab.swiftindex 07390bb6..28e8c286 100644--- a/Peel/Views/Terminal/GitTab.swift+++ b/Peel/Views/Terminal/GitTab.swift@@ -24,6 +24,10 @@ struct GitTab: View {Section {StatusLabel(title: Text("Git couldn’t read its settings"), tint: .accentColor)}+ } else if state.known == nil {+ Section {+ StatusLabel(title: Text("Git didn’t answer"), tint: .accentColor)+ }} else if git.wasRefused {Section {StatusLabel(title: Text("Git refused it"), tint: .accentColor)diff --git a/Peel/Views/Terminal/SSHTab.swift b/Peel/Views/Terminal/SSHTab.swiftindex 09421c0c..839deac6 100644--- a/Peel/Views/Terminal/SSHTab.swift+++ b/Peel/Views/Terminal/SSHTab.swift@@ -15,6 +15,14 @@ struct SSHTab: View {StatusLabel(title: Text("macOS refused it"), tint: .accentColor).font(.caption).foregroundStyle(.secondary)+ } else if state.settings == nil {+ StatusLabel(title: Text("Peel’s settings file couldn’t be read"), tint: .accentColor)+ .font(.caption)+ .foregroundStyle(.secondary)+ } else if state.accepted == nil {+ StatusLabel(title: Text("ssh didn’t answer"), tint: .accentColor)+ .font(.caption)+ .foregroundStyle(.secondary)} else {Text("What ~/.ssh/config sets earlier for a server stays in force, since ssh uses the first value it finds.").font(.caption)diff --git a/Peel/Views/Terminal/ShellTab.swift b/Peel/Views/Terminal/ShellTab.swiftindex 810146f7..005207b2 100644--- a/Peel/Views/Terminal/ShellTab.swift+++ b/Peel/Views/Terminal/ShellTab.swift@@ -15,6 +15,14 @@ struct ShellTab: View {StatusLabel(title: Text("macOS refused it"), tint: .accentColor).font(.caption).foregroundStyle(.secondary)+ } else if state.startupFile != nil, state.choices == nil {+ StatusLabel(title: Text("Peel’s settings file couldn’t be read"), tint: .accentColor)+ .font(.caption)+ .foregroundStyle(.secondary)+ } else if state.startupFile != nil, state.known == nil {+ StatusLabel(title: Text("zsh didn’t answer"), tint: .accentColor)+ .font(.caption)+ .foregroundStyle(.secondary)} else if state.startupFile != nil {Text("Takes effect in new windows").font(.caption)