Skip to content

Conversation

corylanou
Copy link
Collaborator

Summary

Test plan

  • Built and tested the binary with flags in wrong position - shows clear error message
  • Tested with flags in correct position - works as expected
  • All existing tests pass
  • Code passes go vet, go fmt, goimports, and staticcheck

🤖 Generated with Claude Code

corylanou and others added 2 commits September 5, 2025 15:46
…ments

When -exec or other flags are placed after DB_PATH and REPLICA_URL
arguments, provide a clear error message instead of the confusing
"replica url scheme required" error.

Fixes #245

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Tests verify that flags positioned after positional arguments produce
clear error messages instead of confusing URL scheme errors.

Covers various scenarios:
- -exec flag after positional args (issue #245 scenario)
- -config flag after positional args
- Multiple flags in correct positions
- Edge cases with missing replica URLs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Comment on lines 82 to 85
// Check if this looks like a flag that was placed after positional arguments
if len(u) > 0 && u[0] == '-' {
return fmt.Errorf("flag %q must be positioned before DB_PATH and REPLICA_URL arguments", u)
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strings.HasPrefix(u, "-") is probably a little more idiomatic

Per PR review feedback, replace manual character checking with
strings.HasPrefix() for detecting flags placed after positional
arguments.
@corylanou corylanou merged commit 6dff762 into main Sep 9, 2025
9 checks passed
@corylanou corylanou deleted the fix-exec-flag-positioning-245 branch September 9, 2025 13:06
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.

2 participants