mirror of https://github.com/buresdv/Cork
+ Brew status page (still buggy) ~ Updated readme
This commit is contained in:
parent
538c21659a
commit
3416af8c68
|
|
@ -13,6 +13,8 @@
|
|||
632FD2972995A7E50029FC49 /* Nicer Text Editor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 632FD2962995A7E50029FC49 /* Nicer Text Editor.swift */; };
|
||||
632FD2992995BF490029FC49 /* Load up Tapped Taps.swift in Sources */ = {isa = PBXBuildFile; fileRef = 632FD2982995BF490029FC49 /* Load up Tapped Taps.swift */; };
|
||||
632FD29B2995C1C20029FC49 /* BrewTap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 632FD29A2995C1C20029FC49 /* BrewTap.swift */; };
|
||||
6330531929966E9F00F34F94 /* Start Page.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6330531829966E9F00F34F94 /* Start Page.swift */; };
|
||||
6330531B2996A16600F34F94 /* GroupBox Headline Group.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6330531A2996A16600F34F94 /* GroupBox Headline Group.swift */; };
|
||||
634065652871AA42001A2178 /* CorkApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 634065642871AA42001A2178 /* CorkApp.swift */; };
|
||||
634065672871AA42001A2178 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 634065662871AA42001A2178 /* ContentView.swift */; };
|
||||
634065692871AA42001A2178 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 634065682871AA42001A2178 /* Assets.xcassets */; };
|
||||
|
|
@ -56,6 +58,8 @@
|
|||
632FD2962995A7E50029FC49 /* Nicer Text Editor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Nicer Text Editor.swift"; sourceTree = "<group>"; };
|
||||
632FD2982995BF490029FC49 /* Load up Tapped Taps.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Load up Tapped Taps.swift"; sourceTree = "<group>"; };
|
||||
632FD29A2995C1C20029FC49 /* BrewTap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrewTap.swift; sourceTree = "<group>"; };
|
||||
6330531829966E9F00F34F94 /* Start Page.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Start Page.swift"; sourceTree = "<group>"; };
|
||||
6330531A2996A16600F34F94 /* GroupBox Headline Group.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GroupBox Headline Group.swift"; sourceTree = "<group>"; };
|
||||
634065612871AA42001A2178 /* Cork.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Cork.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
634065642871AA42001A2178 /* CorkApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CorkApp.swift; sourceTree = "<group>"; };
|
||||
634065662871AA42001A2178 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -113,6 +117,14 @@
|
|||
path = Taps;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6330531729966E9200F34F94 /* Start Page */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6330531829966E9F00F34F94 /* Start Page.swift */,
|
||||
);
|
||||
path = "Start Page";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
634065582871AA42001A2178 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
|
@ -251,6 +263,7 @@
|
|||
639A7D812871D07800B50280 /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6330531729966E9200F34F94 /* Start Page */,
|
||||
632FD2932995A3870029FC49 /* Taps */,
|
||||
63CD0277288B2307004AE2EC /* Package Details */,
|
||||
63958CFE287735ED00E0B807 /* About */,
|
||||
|
|
@ -260,6 +273,7 @@
|
|||
63A874692990127D009F9533 /* PillText.swift */,
|
||||
632FD291299596790029FC49 /* HelpButton.swift */,
|
||||
632FD2962995A7E50029FC49 /* Nicer Text Editor.swift */,
|
||||
6330531A2996A16600F34F94 /* GroupBox Headline Group.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -394,6 +408,8 @@
|
|||
6340657D2871AC65001A2178 /* Brew Package.swift in Sources */,
|
||||
637E00642872F3CE005C9890 /* Upgrade Packages.swift in Sources */,
|
||||
6371EA2D287202F400300E1B /* Extract from JSON.swift in Sources */,
|
||||
6330531929966E9F00F34F94 /* Start Page.swift in Sources */,
|
||||
6330531B2996A16600F34F94 /* GroupBox Headline Group.swift in Sources */,
|
||||
632FD290299591C10029FC49 /* Get Folder Size.swift in Sources */,
|
||||
6371EA1E2871D98100300E1B /* Package List Item.swift in Sources */,
|
||||
637E006B28734041005C9890 /* Install Selected Packages.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "davidfoundation",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/buresdv/DavidFoundation",
|
||||
"state" : {
|
||||
"branch" : "main",
|
||||
"revision" : "5127d89d1543485eebc0de6b5ad21d84f7aa8072"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 2
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
uuid = "EE63D6E0-39CA-40C2-BB8C-199291CD2C16"
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
<Breakpoints>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "9A036084-ECF6-4B11-879F-D49F8D635A57"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Cork/Views/Add Formula.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "150"
|
||||
endingLineNumber = "150"
|
||||
landmarkName = "body"
|
||||
landmarkType = "24">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "4A69BEF4-7181-45B4-997B-96631DF95B15"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Cork/Views/Add Formula.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "157"
|
||||
endingLineNumber = "157"
|
||||
landmarkName = "body"
|
||||
landmarkType = "24">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "7672091D-B94D-4F55-BC1D-F5CEA6390226"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Cork/Logic/Shell/Brew Interface.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "63"
|
||||
endingLineNumber = "63"
|
||||
landmarkName = "tapAtap(tapName:)"
|
||||
landmarkType = "9">
|
||||
<Locations>
|
||||
<Location
|
||||
uuid = "7672091D-B94D-4F55-BC1D-F5CEA6390226 - 81ef5208c6052492"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "(1) suspend resume partial function for Cork.tapAtap(tapName: Swift.String) async -> Swift.String"
|
||||
moduleName = "Cork"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/david/Documents/xCode%20Projekty/macOS/Cork/Cork/Logic/Shell/Brew%20Interface.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "46"
|
||||
endingLineNumber = "46"
|
||||
offsetFromSymbolStart = "88">
|
||||
</Location>
|
||||
<Location
|
||||
uuid = "7672091D-B94D-4F55-BC1D-F5CEA6390226 - de70eec50aad6bc"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "(2) await resume partial function for Cork.tapAtap(tapName: Swift.String) async -> Swift.String"
|
||||
moduleName = "Cork"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/david/Documents/xCode%20Projekty/macOS/Cork/Cork/Logic/Shell/Brew%20Interface.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "46"
|
||||
endingLineNumber = "46"
|
||||
offsetFromSymbolStart = "44">
|
||||
</Location>
|
||||
<Location
|
||||
uuid = "7672091D-B94D-4F55-BC1D-F5CEA6390226 - f8b45ea2f8891098"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "(3) suspend resume partial function for Cork.tapAtap(tapName: Swift.String) async -> Swift.String"
|
||||
moduleName = "Cork"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/david/Documents/xCode%20Projekty/macOS/Cork/Cork/Logic/Shell/Brew%20Interface.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "46"
|
||||
endingLineNumber = "46"
|
||||
offsetFromSymbolStart = "104">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "49FAB07B-3680-414E-B99C-D35138F9ECBE"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Cork/Logic/Shell/Brew Interface.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "65"
|
||||
endingLineNumber = "65"
|
||||
landmarkName = "tapAtap(tapName:)"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
|
@ -113,9 +113,11 @@ struct ContentView: View
|
|||
.collapsible(false)
|
||||
}
|
||||
.listStyle(SidebarListStyle())
|
||||
|
||||
StartPage(brewData: brewData, updateProgressTracker: updateProgressTracker)
|
||||
}
|
||||
.navigationTitle("Cork")
|
||||
.navigationSubtitle("\(brewData.installedCasks.count + brewData.installedFormulae.count) packages installed")
|
||||
.navigationSubtitle("\(brewData.installedFormulae.count + brewData.installedCasks.count) packages installed")
|
||||
.toolbar
|
||||
{
|
||||
ToolbarItemGroup(placement: .primaryAction)
|
||||
|
|
@ -176,7 +178,7 @@ struct ContentView: View
|
|||
}
|
||||
.sheet(isPresented: $isShowingTapSheet)
|
||||
{
|
||||
AddTapView(isShowingSheet: $isShowingTapSheet)
|
||||
AddTapView(isShowingSheet: $isShowingTapSheet, availableTaps: availableTaps)
|
||||
}
|
||||
.sheet(isPresented: $updateProgressTracker.showUpdateSheet)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,6 +41,23 @@ func getListOfFoundPackages(searchWord: String) async -> String
|
|||
return parsedResponse!
|
||||
}
|
||||
|
||||
func getListOfUpgradeablePackages() async -> [BrewPackage]
|
||||
{
|
||||
var finalOutdatedPackages = [BrewPackage]()
|
||||
|
||||
let outdatedPackagesRaw: String = await shell("/opt/homebrew/bin/brew", ["outdated"])!
|
||||
|
||||
let outdatedPackages = outdatedPackagesRaw.components(separatedBy: "\n")
|
||||
|
||||
for package in outdatedPackages {
|
||||
finalOutdatedPackages.append(BrewPackage(name: package, installedOn: nil, versions: [""], sizeInBytes: nil))
|
||||
}
|
||||
|
||||
finalOutdatedPackages.removeLast()
|
||||
|
||||
return finalOutdatedPackages
|
||||
}
|
||||
|
||||
func tapAtap(tapName: String) async -> String
|
||||
{
|
||||
let tapResult = await shell("/opt/homebrew/bin/brew", ["tap", tapName])!
|
||||
|
|
|
|||
|
|
@ -20,11 +20,15 @@ func upgradeBrewPackages(_ updateProgressTracker: UpdateProgressTracker)
|
|||
updateProgressTracker.updateProgress += 0.2
|
||||
let updateResult = await shell("/opt/homebrew/bin/brew", ["update"])!
|
||||
updateProgressTracker.updateProgress += 0.3
|
||||
|
||||
print("update result: \(updateResult)")
|
||||
|
||||
updateProgressTracker.updateStage = .upgrading
|
||||
updateProgressTracker.updateProgress += 0.2
|
||||
let upgradeResult = await shell("/opt/homebrew/bin/brew", ["upgrade"])!
|
||||
updateProgressTracker.updateProgress += 0.3
|
||||
|
||||
print("Upgrade result: \(upgradeResult)")
|
||||
|
||||
updateProgressTracker.showUpdateSheet = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// GroupBox Headline Group.swift
|
||||
// Cork
|
||||
//
|
||||
// Created by David Bureš on 10.02.2023.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct GroupBoxHeadlineGroup: View {
|
||||
|
||||
@State var title: String
|
||||
@State var mainText: String
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading)
|
||||
{
|
||||
Text(title)
|
||||
.font(.headline)
|
||||
Text(mainText)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
//
|
||||
// Start Page.swift
|
||||
// Cork
|
||||
//
|
||||
// Created by David Bureš on 10.02.2023.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct StartPage: View
|
||||
{
|
||||
@ObservedObject var brewData: BrewDataStorage
|
||||
|
||||
@State var updateProgressTracker: UpdateProgressTracker
|
||||
|
||||
@State var upgradeablePackages: [BrewPackage] = .init()
|
||||
|
||||
@State private var isDisclosureGroupExpanded: Bool = false
|
||||
|
||||
var body: some View
|
||||
{
|
||||
VStack
|
||||
{
|
||||
if upgradeablePackages.isEmpty
|
||||
{
|
||||
ProgressView
|
||||
{
|
||||
Text("Checking for Package Updates...")
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VStack
|
||||
{
|
||||
VStack(alignment: .leading)
|
||||
{
|
||||
Text("Homebrew Status")
|
||||
.font(.title)
|
||||
|
||||
GroupBox
|
||||
{
|
||||
if upgradeablePackages.count == 0
|
||||
{
|
||||
GroupBoxHeadlineGroup(title: "You are all up-to-date", mainText: "There are no packages to update")
|
||||
}
|
||||
else
|
||||
{
|
||||
Grid
|
||||
{
|
||||
GridRow(alignment: .firstTextBaseline)
|
||||
{
|
||||
if upgradeablePackages.count == 1
|
||||
{
|
||||
VStack(alignment: .leading)
|
||||
{
|
||||
Text("There is 1 outdated package")
|
||||
.font(.headline)
|
||||
DisclosureGroup(isExpanded: $isDisclosureGroupExpanded)
|
||||
{} label: {
|
||||
Text("Outdated packages")
|
||||
.font(.subheadline)
|
||||
}
|
||||
|
||||
if isDisclosureGroupExpanded
|
||||
{
|
||||
List(upgradeablePackages)
|
||||
{ package in
|
||||
Text(package.name)
|
||||
}
|
||||
.listStyle(.bordered(alternatesRowBackgrounds: true))
|
||||
.frame(maxHeight: 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VStack(alignment: .leading)
|
||||
{
|
||||
Text("There are \(upgradeablePackages.count) outdated packages")
|
||||
.font(.headline)
|
||||
DisclosureGroup(isExpanded: $isDisclosureGroupExpanded)
|
||||
{} label: {
|
||||
Text("Outdated packages")
|
||||
.font(.subheadline)
|
||||
}
|
||||
|
||||
if isDisclosureGroupExpanded
|
||||
{
|
||||
List(upgradeablePackages)
|
||||
{ package in
|
||||
Text(package.name)
|
||||
}
|
||||
.listStyle(.bordered(alternatesRowBackgrounds: true))
|
||||
.frame(maxHeight: 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
upgradeBrewPackages(updateProgressTracker)
|
||||
} label: {
|
||||
Text("Update")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GroupBox
|
||||
{
|
||||
Grid(alignment: .leading)
|
||||
{
|
||||
GridRow(alignment: .firstTextBaseline) {
|
||||
GroupBoxHeadlineGroup(title: "You have \(brewData.installedFormulae.count) Formulae installed", mainText: "Formulae are usually apps that you run in a terminal")
|
||||
}
|
||||
|
||||
Divider()
|
||||
|
||||
GridRow(alignment: .firstTextBaseline) {
|
||||
GroupBoxHeadlineGroup(title: "You have \(brewData.installedCasks.count) Casks instaled", mainText: "Casks are usually graphical apps")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.onAppear
|
||||
{
|
||||
Task
|
||||
{
|
||||
upgradeablePackages = await getListOfUpgradeablePackages()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,8 @@ struct AddTapView: View
|
|||
@State private var requestedTap: String = ""
|
||||
|
||||
@State private var isShowingErrorPopover: Bool = false
|
||||
|
||||
@StateObject var availableTaps: AvailableTaps
|
||||
|
||||
var body: some View
|
||||
{
|
||||
|
|
@ -128,6 +130,8 @@ struct AddTapView: View
|
|||
.font(.headline)
|
||||
.onAppear
|
||||
{
|
||||
|
||||
availableTaps.tappedTaps.append(BrewTap(name: requestedTap))
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 3)
|
||||
{
|
||||
isShowingSheet = false
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
# Cork
|
||||
A fast GUI wrapper for Homebrew written in SwiftUI
|
||||
|
||||
# WARNING: THIS APP IS STILL EARLY IN DEVELOPMENT
|
||||
## You will encounter bugs, random crashes and updates that hang. There's minimal error checking for now. Use only at own risk for the time being!
|
||||
|
||||
## Screenshots
|
||||
### Main Window
|
||||

|
||||
|
|
|
|||
Loading…
Reference in New Issue