Skip to content

Add --output=json support to cp and mv commands - #275

Merged
AndreyVMarkelov merged 1 commit into
masterfrom
cp-mv-json-output
Jun 24, 2026
Merged

Add --output=json support to cp and mv commands#275
AndreyVMarkelov merged 1 commit into
masterfrom
cp-mv-json-output

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Migrate cp and mv to emit structured JSON with {"results": [...]} containing from_path, to_path, and result metadata per operation
  • Add shared cmd/relocation_output.go with relocationInput/relocationResult/relocationOutput types used by both commands
  • Errors now write to cmd.ErrOrStderr() instead of os.Stderr for testability
  • Text mode behavior unchanged (silent on success)

Test plan

  • go vet ./... clean
  • golangci-lint run ./... clean
  • All tests pass (go test ./... -count=1)
  • Manual: dbxcli cp --output=json /src.txt /dest.txt emits JSON with relocation result
  • Manual: dbxcli mv --output=json /src.txt /dest.txt emits JSON with relocation result
  • Manual: dbxcli cp /src.txt /dest.txt text mode unchanged (silent)

Emit relocation results as structured JSON with from_path, to_path,
and result metadata. Share relocation_output.go types across both
commands. Errors now write to cmd.ErrOrStderr() for testability.
@AndreyVMarkelov
AndreyVMarkelov merged commit 3dd5b60 into master Jun 24, 2026
7 checks passed
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