mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-06 03:20:09 +02:00
🚧 WIP: Changes related to unavailable formulae
This commit is contained in:
@ -47,14 +47,15 @@ struct BrewPhpFormula: Equatable {
|
||||
var hasUpgrade: Bool {
|
||||
return upgradeVersion != nil
|
||||
}
|
||||
|
||||
|
||||
var hasFormulaFile: Bool {
|
||||
guard let version = shortVersion else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
return FileSystem.fileExists(
|
||||
"\(Paths.tapPath)/shivammathur/homebrew-php/Formula/php@\(version).rb"
|
||||
.replacingOccurrences(of: "php@" + PhpEnvironments.brewPhpAlias, with: "php")
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -269,16 +269,7 @@ struct PhpVersionManagerView: View {
|
||||
.font(.system(size: 11))
|
||||
.foregroundColor(.gray)
|
||||
} else if !formula.hasFormulaFile {
|
||||
HStack(spacing: 5) {
|
||||
Text("phpman.version.unavailable".localizedForSwiftUI)
|
||||
.font(.system(size: 11))
|
||||
.foregroundColor(.gray)
|
||||
HelpButton(action: {
|
||||
// Show an alert that displays information about the missing formula
|
||||
// and what can be done to fix this particular issue.
|
||||
// Running `brew tap shivammathur/php` generally works, I think.
|
||||
})
|
||||
}
|
||||
unavailableFormula()
|
||||
} else {
|
||||
Text("phpman.version.available_for_installation".localizedForSwiftUI)
|
||||
.font(.system(size: 11))
|
||||
@ -294,6 +285,19 @@ struct PhpVersionManagerView: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
private func unavailableFormula() -> some View {
|
||||
HStack(spacing: 5) {
|
||||
Text("phpman.version.unavailable".localizedForSwiftUI)
|
||||
.font(.system(size: 11))
|
||||
.foregroundColor(.gray)
|
||||
HelpButton(action: {
|
||||
// Show an alert that displays information about the missing formula
|
||||
// and what can be done to fix this particular issue.
|
||||
// Running `brew tap shivammathur/php` generally works, I think.
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private func formulaIcon(for formula: BrewPhpFormula) -> some View {
|
||||
Image(systemName: formula.icon)
|
||||
.resizable()
|
||||
|
Reference in New Issue
Block a user