Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utmctl export command #6553

Open
naveenrajm7 opened this issue Aug 12, 2024 · 3 comments · May be fixed by #6716
Open

Add utmctl export command #6553

naveenrajm7 opened this issue Aug 12, 2024 · 3 comments · May be fixed by #6716
Labels
enhancement New feature or request
Milestone

Comments

@naveenrajm7
Copy link

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

@naveenrajm7 naveenrajm7 added the enhancement New feature or request label Aug 12, 2024
@naveenrajm7
Copy link
Author

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.

@osy osy added this to the Future milestone Aug 22, 2024
@osy
Copy link
Contributor

osy commented Aug 22, 2024

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.

@naveenrajm7
Copy link
Author

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.

@naveenrajm7 naveenrajm7 linked a pull request Oct 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants