UTM
UTM copied to clipboard
Add utmctl export command
What
utmctl export <identifier> <export-path>
How
There is already a 'Share...' action that exports the VM and its contents, we need to expose this function via utmctl.
Why
This allows us to programmatically export the VMs. Plugins like Vagrant-UTM, Packer-UTM can use this API to package UTM VMs. Useful for packaging and distributing custom UTM VMs.
Related #3718
I am trying to build this myself.
/Applications/UTMdev.app/Contents/MacOS/utmctl export --help
OVERVIEW: Export the virtual machine and all its data.
USAGE: utmctl export [--debug] [--hide] <identifier> <export-path>
ARGUMENTS:
<identifier> Either the UUID or the complete name of the virtual machine.
<export-path> Path to the exported VM.
But I am not able to call the export function I have written in file UTMScriptingVirtualMachineImpl.swift through UTMCtl.swift .
I am not able to understand how the functions in UTMScripting.swift (show below) are connected with functions in UTMScriptingVirtualMachineImpl.swift
// MARK: UTMScriptingGenericMethods
@objc public protocol UTMScriptingGenericMethods {
@objc optional func closeSaving(_ saving: UTMScriptingSaveOptions, savingIn: URL!) // Close a document.
@objc optional func saveIn(_ in_: URL!, as: Any!) // Save a document.
@objc optional func printWithProperties(_ withProperties: [AnyHashable : Any]!, printDialog: Bool) // Print a document.
@objc optional func delete() // Delete an object.
// How is this able to call the function clone at file UTMScriptingVirtualMachineImpl.swift
@objc optional func duplicateTo(_ to: SBObject!, withProperties: [AnyHashable : Any]!) // Copy an object.
@objc optional func moveTo(_ to: SBObject!) // Move an object to a new location.
// How should I make this ?
@objc optional func exportTo(_ to: SBObject!, path: URL!) // Export an object to a new location.
}
Any help will enable me to add this feature and expose more features to utmctl / applescripting bridge.
Uh that entire interface is kind of a mess. The protocols are generated from the sdef and the other code are glue to connect them together.
Oh okay, I have the code but I need to connect the cli command to the code. I'll keep trying.
I have opened a similar request for import. Thanks for considering this for future milestones.