UTM icon indicating copy to clipboard operation
UTM copied to clipboard

scripting: add import command

Open naveenrajm7 opened this issue 1 year ago • 0 comments

Solves (partially) #6612 .

  • Added new function importNewUTM
  • Expose importNewUTM as an import command in Apple Script.

if useful the same function can be exposed via UI (File > Import)

Apple Script usage

tell application "/Users/x../UTM.app"
  set vmFile to POSIX file "/Users/x../Desktop/ubuntu.utm"
  set vm to import new virtual machine from vmFile
end tell

Returns VM UUID

%osascript import_vm.applescript
virtual machine id D9C7A2A9-D1C9-4F8D-A733-2E028C573234

Import is not yet exposed through utmctl , this will be added in future. Reason: The bridge protocol generator produced a function signature importNew(_ new_: NSNumber!, from: URL!) -> SBObject , I don't know how to pass 'virtual machine' ObjectClass as NSNumber. While this is being figured out, just having import function (multiple VMs with same utm file) will enable lot of other things (like vagrant box support, see https://github.com/naveenrajm7/vagrant_utm/discussions/3).

naveenrajm7 avatar Oct 10 '24 03:10 naveenrajm7