Skip to content

Add cp support to container machine - #2211

Open
kavix wants to merge 1 commit into
apple:mainfrom
kavix:feat/machine-cp
Open

Add cp support to container machine#2211
kavix wants to merge 1 commit into
apple:mainfrom
kavix:feat/machine-cp

Conversation

@kavix

@kavix kavix commented Aug 29, 2026

Copy link
Copy Markdown

Description

Closes #2141

This PR adds file copy support (copy / cp) to container machine, allowing users to copy files and directories between the host and a container machine by machine name (e.g. container machine cp ./README.md dev:/root/ or container machine cp dev:/root/README.md ./README.md).

Previously, copying files into container machines with --home-mount none required manually inspecting the underlying container ID and invoking container cp.

Changes

  • Added MachineCopy command: Implemented Application.MachineCopy in Sources/ContainerCommands/Machine/MachineCopy.swift to handle:
    • Copying from host to container machine (local:path -> machine:path).
    • Copying from container machine to host (machine:path -> local:path).
    • Resolving machine name/ID to its running containerId via MachineClient.inspect(id:).
    • Rejection of invalid paths (local-to-local and machine-to-machine).
  • Subcommand registration: Added MachineCopy.self (with alias cp) under MachineCommand.configuration.subcommands.
  • Testing: Added unit/validation tests in TestCLIMachineCommand.swift verifying argument validation and error handling for container machine cp.

Checklist

  • Code follows the project's style guidelines.
  • Added unit / integration tests covering the new behavior.
  • Verified CLI help output and error handling.

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.

[Request]: machine command cp support

1 participant