diff --git a/Sources/tart/Commands/Clone.swift b/Sources/tart/Commands/Clone.swift index 799c57b..4013921 100644 --- a/Sources/tart/Commands/Clone.swift +++ b/Sources/tart/Commands/Clone.swift @@ -3,7 +3,20 @@ import Foundation import SystemConfiguration struct Clone: AsyncParsableCommand { - static var configuration = CommandConfiguration(abstract: "Clone a VM") + static var configuration = CommandConfiguration( + abstract: "Clone a VM", + discussion: """ + Creates a local virtual machine by cloning either a remote or another local virtual machine. + + Due to copy-on-write magic in Apple File System a cloned VM won't actually claim all the space right away. + Only changes to a cloned disk will be written and claim new space. By default, Tart checks available capacity + in Tart's home directory and checks if there is enough space for the worst possible scenario: when the whole disk + will be modified. + + This behaviour can be disabled by setting TART_NO_AUTO_PRUNE environment variable. This might be helpful + for use cases when the original image is very big and a workload is known to only modify a fraction of the cloned disk. + """ + ) @Argument(help: "source VM name") var sourceName: String diff --git a/Sources/tart/Commands/Prune.swift b/Sources/tart/Commands/Prune.swift index be0c7f0..abb555e 100644 --- a/Sources/tart/Commands/Prune.swift +++ b/Sources/tart/Commands/Prune.swift @@ -105,6 +105,10 @@ struct Prune: AsyncParsableCommand { } static func reclaimIfNeeded(_ requiredBytes: UInt64, _ initiator: Prunable? = nil) throws { + if ProcessInfo.processInfo.environment.keys.contains("TART_NO_AUTO_PRUNE") { + return + } + SentrySDK.configureScope { scope in scope.setContext(value: ["requiredBytes": requiredBytes], key: "Prune") } diff --git a/Sources/tart/Commands/Pull.swift b/Sources/tart/Commands/Pull.swift index 6ffd6a9..c728689 100644 --- a/Sources/tart/Commands/Pull.swift +++ b/Sources/tart/Commands/Pull.swift @@ -3,7 +3,16 @@ import Dispatch import SwiftUI struct Pull: AsyncParsableCommand { - static var configuration = CommandConfiguration(abstract: "Pull a VM from a registry") + static var configuration = CommandConfiguration( + abstract: "Pull a VM from a registry", + discussion: """ + Pulls a virtual machine from a remote OCI-compatible registry. Supports authorization via Keychain (see "tart login --help"), + Docker credential helpers defined in ~/.docker/config.json or via TART_REGISTRY_USERNAME/TART_REGISTRY_PASSWORD environment variables. + + By default, Tart checks available capacity in Tart's home directory and tries to reclaim minimum possible storage for the remote image to fit via "tart prune". + This behaviour can be disabled by setting TART_NO_AUTO_PRUNE environment variable. + """ + ) @Argument(help: "remote VM name") var remoteName: String