Skip to content

fix(cli): accept positional image path for send#41

Merged
ShunmeiCho merged 1 commit intomainfrom
fix/send-positional-file-ux
Apr 22, 2026
Merged

fix(cli): accept positional image path for send#41
ShunmeiCho merged 1 commit intomainfrom
fix/send-positional-file-ux

Conversation

@ShunmeiCho
Copy link
Copy Markdown
Owner

Summary

  • Treat a single positional image path as the send file input, equivalent to --file
  • Preserve host-first/default-host forms and reject ambiguous extra positionals or flags after post-flag positionals
  • Add parser regression coverage and update CLI/docs help text for send [] []

Context

Follow-up to the #30 Windows smoke-test feedback where cc-clip send --paste C:\test.png appeared to work. The old parser left that path in fs.Args() and silently read the clipboard instead.

Tests

  • go test ./cmd/cc-clip -run TestParseSendArgs -count=1
  • go test ./... -count=1
  • go vet ./...
  • go run ./cmd/cc-clip --help
  • env GOOS=windows GOARCH=amd64 go test -c ./cmd/cc-clip -o /tmp/cc-clip-windows.test.exe

Not tested: real Windows clipboard paste against a remote host.

Windows smoke testing showed users can reasonably expect cc-clip send --paste C:\test.png to upload that file, but the previous parser left the path in fs.Args() and silently read the clipboard instead. This makes one positional image path an explicit --file equivalent while preserving host-first/default-host forms and rejecting trailing flags after positionals.

Constraint: Go flag package stops at first positional arg, so parser has to normalize leading and trailing positionals before upload

Rejected: Error on all unexpected positionals | would preserve the reporter's confusing failure mode instead of supporting the intuitive path form

Confidence: high

Scope-risk: narrow

Directive: Keep send parser tests covering default-host, host-first, post-flag, and conflict forms before changing CLI grammar

Tested: go test ./... -count=1; go vet ./...; go run ./cmd/cc-clip --help; env GOOS=windows GOARCH=amd64 go test -c ./cmd/cc-clip -o /tmp/cc-clip-windows.test.exe

Not-tested: Real Windows clipboard paste against a remote host
@ShunmeiCho ShunmeiCho merged commit 9b3ca6d into main Apr 22, 2026
@ShunmeiCho ShunmeiCho deleted the fix/send-positional-file-ux branch April 22, 2026 11:41
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