From 195a4b3a724bcaac8838f4021f9cc64b18b86d36 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Wed, 24 Aug 2022 23:03:54 +0400 Subject: [PATCH] Make UnsupportedOSError more user-friendly (#192) * Make UnsupportedOSError more user-friendly * tart prune: allow only specifying a --gc flag --- Sources/tart/Commands/Prune.swift | 4 ++-- Sources/tart/VM.swift | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/tart/Commands/Prune.swift b/Sources/tart/Commands/Prune.swift index cab8eaf..a88f14a 100644 --- a/Sources/tart/Commands/Prune.swift +++ b/Sources/tart/Commands/Prune.swift @@ -20,8 +20,8 @@ struct Prune: AsyncParsableCommand { var gc: Bool = false func validate() throws { - if olderThan == nil && cacheBudget == nil { - throw ValidationError("at least one criteria must be specified") + if olderThan == nil && cacheBudget == nil && !gc { + throw ValidationError("at least one pruning criteria must be specified") } } diff --git a/Sources/tart/VM.swift b/Sources/tart/VM.swift index da8324b..419f24c 100644 --- a/Sources/tart/VM.swift +++ b/Sources/tart/VM.swift @@ -10,7 +10,8 @@ struct NoMainScreenFoundError: Error { struct DownloadFailed: Error { } -struct UnsupportedOSError: Error { +struct UnsupportedOSError: Error, CustomStringConvertible { + private(set) var description: String = "error: Linux VMs are only supported on macOS 13.0 (Ventura) or newer" } struct UnsupportedArchitectureError: Error {