mirror of
https://github.com/cirruslabs/tart.git
synced 2026-10-17 19:36:10 +02:00
Support "tart --version" (#81)
* Support "tart --version" * Move CI.swift patcher into a separate script Otherwise it doesn't work in GoReleaser.
This commit is contained in:
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat Sources/tart/CI/CI.swift | envsubst | tee Sources/tart/CI/CI.swift
|
||||
@@ -11,6 +11,7 @@ builds:
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- .ci/set-version.sh
|
||||
- swift build -c release --product tart
|
||||
- codesign --sign - --entitlements Resources/tart.entitlements --force .build/arm64-apple-macosx/release/tart
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
struct CI {
|
||||
private static let rawVersion = "${CIRRUS_TAG}"
|
||||
|
||||
static var version: String {
|
||||
rawVersion.expanded() ? rawVersion : "SNAPSHOT"
|
||||
}
|
||||
}
|
||||
|
||||
private extension String {
|
||||
func expanded() -> Bool {
|
||||
!isEmpty && !starts(with: "$")
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,8 @@ struct Run: AsyncParsableCommand {
|
||||
CommandGroup(replacing: .textEditing, addition: {})
|
||||
CommandGroup(replacing: .undoRedo, addition: {})
|
||||
CommandGroup(replacing: .windowSize, addition: {})
|
||||
// Replace some standard menu options
|
||||
CommandGroup(replacing: .appInfo) { AboutTart() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +72,19 @@ struct Run: AsyncParsableCommand {
|
||||
}
|
||||
}
|
||||
|
||||
struct AboutTart: View {
|
||||
var body: some View {
|
||||
Button("About Tart") {
|
||||
NSApplication.shared.orderFrontStandardAboutPanel(options: [
|
||||
NSApplication.AboutPanelOptionKey.applicationIcon: NSApplication.shared.applicationIconImage as Any,
|
||||
NSApplication.AboutPanelOptionKey.applicationName: "Tart",
|
||||
NSApplication.AboutPanelOptionKey.applicationVersion: CI.version,
|
||||
NSApplication.AboutPanelOptionKey.credits: try! NSAttributedString(markdown: "https://github.com/cirruslabs/tart"),
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct VMView: NSViewRepresentable {
|
||||
typealias NSViewType = VZVirtualMachineView
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import Foundation
|
||||
struct Root: AsyncParsableCommand {
|
||||
static var configuration = CommandConfiguration(
|
||||
commandName: "tart",
|
||||
version: CI.version,
|
||||
subcommands: [
|
||||
Create.self,
|
||||
Clone.self,
|
||||
|
||||
Reference in New Issue
Block a user