-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
k8sql accepts conflicting CLI inputs and silently prioritizes one path over another in some cases. This can ignore user intent without warning.
Reproduced behavior
1) -q and -f together
k8sql -q "SELECT 1" -f /tmp/realfile.sqlObserved: executes -q query and ignores -f.
2) Global query flag with subcommand
k8sql -q "SELECT 1" daemonObserved: starts daemon, query is ignored.
3) Position-dependent UX inconsistency
k8sql daemon -q "SELECT 1"Observed: clap rejects -q as unexpected argument.
Equivalent conflicting intent is accepted/rejected depending on ordering.
Affected code
- CLI definitions:
src/cli/args.rs - Precedence in runtime dispatch:
src/main.rs
Root cause
Argsdoes not declare conflicts between:commandvsquerycommandvsfilequeryvsfile
mainthen applies imperative precedence (commandfirst, then batch;querybeforefile).
Impact
- Silent argument ignoring
- Confusing UX
- Script/automation mistakes are harder to detect
Proposed fix (recommended)
Use clap-level constraints so invalid combinations fail fast with clear messages:
queryconflicts withfileandcommandfileconflicts withqueryandcommand- Optionally model batch args in an
ArgGroupfor clarity
Tests to add
Add parser tests for failures on:
k8sql -q "..." -f file.sqlk8sql -q "..." daemonk8sql -f file.sql interactive
Ensure errors are stable and user-facing.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels