feat: add mdrive export and list --json CLI commands - #161
Merged
Merged
Conversation
Adds a non-interactive `export` subcommand (to .mdr image or zip/7z archive) and a `--json` flag on `list`, mirroring the existing MainViewModel-backed CLI adapter pattern used by mount/save/snapshot. Cli.Core keeps its own copy of ArchiveExportFormat (like the existing ImageCompressionLevel copy) since it must not reference ManagedDrive.Core.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
exportsubcommand (mdrive export <drive> <output-path> [--format Zip|SevenZip] [--compression ...] [--password/--password-file]), exporting a mounted disk to a standalone.mdrimage or zip/7z archive without touching the disk's own persistence config. Mirrors the existingMainViewModel.*ByMountPointAsyncCLI adapter pattern (SaveByMountPointAsync,MountImageAsync, etc.).--jsonflag tomdrive list, serializing the disk list as JSON instead of a Spectre table — useful for scripting.ManagedDrive.Cli.Corekeeps its own copy ofArchiveExportFormat(mirroring the existingImageCompressionLevelcopy already in that project), sinceCli.Coremust not referenceManagedDrive.Core.CliOutcome.Jsonflag throughCliResponse/CliPipeProtocolso--jsonworks correctly whenmdrive.exeforwards to an already-runningManagedDrive.exeover the named pipe, not just the direct-launch path.Out of scope for this PR (left for a future batch): non-interactive
create/editandtemp set/reset— these need a separate design pass for how to downgradeCreateDiskDialog's confirmation flows (mount-point conflicts, password-removal confirmation, temp-dir reset) to a non-interactive CLI.Test plan
dotnet build -c Release— 0 warnings, 0 errorsdotnet test tests/ManagedDrive.Tests -c Release— 354/354 passed, including newExport_*/List_Json_*cases inCliCommandProcessorMountTests.csdotnet format --verify-no-changes --no-restore— cleanmdrive export R: out.mdr,mdrive export R: out.zip --format Zip, andmdrive list --jsonboth whenManagedDrive.exeis already running (named-pipe path) and when it needs to be launched