Skip to content

feat: add mdrive export and list --json CLI commands - #161

Merged
coldhighsun merged 1 commit into
mainfrom
feature/cli-export-list-json
Sep 16, 2026
Merged

coldhighsun merged 1 commit into
mainfrom
feature/cli-export-list-json

Conversation

@coldhighsun

Copy link
Copy Markdown
Owner

Summary

  • Adds a non-interactive export subcommand (mdrive export <drive> <output-path> [--format Zip|SevenZip] [--compression ...] [--password/--password-file]), exporting a mounted disk to a standalone .mdr image or zip/7z archive without touching the disk's own persistence config. Mirrors the existing MainViewModel.*ByMountPointAsync CLI adapter pattern (SaveByMountPointAsync, MountImageAsync, etc.).
  • Adds a --json flag to mdrive list, serializing the disk list as JSON instead of a Spectre table — useful for scripting.
  • ManagedDrive.Cli.Core keeps its own copy of ArchiveExportFormat (mirroring the existing ImageCompressionLevel copy already in that project), since Cli.Core must not reference ManagedDrive.Core.
  • Also threads the new CliOutcome.Json flag through CliResponse/CliPipeProtocol so --json works correctly when mdrive.exe forwards to an already-running ManagedDrive.exe over the named pipe, not just the direct-launch path.

Out of scope for this PR (left for a future batch): non-interactive create/edit and temp set/reset — these need a separate design pass for how to downgrade CreateDiskDialog'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 errors
  • dotnet test tests/ManagedDrive.Tests -c Release — 354/354 passed, including new Export_*/List_Json_* cases in CliCommandProcessorMountTests.cs
  • dotnet format --verify-no-changes --no-restore — clean
  • Manual smoke test on a real machine: mount a disk, run mdrive export R: out.mdr, mdrive export R: out.zip --format Zip, and mdrive list --json both when ManagedDrive.exe is already running (named-pipe path) and when it needs to be launched

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.
@coldhighsun
coldhighsun merged commit 9bf8221 into main Sep 16, 2026
3 checks passed
@coldhighsun
coldhighsun deleted the feature/cli-export-list-json branch September 16, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant