CLI consistency: connection flags vs URI, -out vs -out-dir, -left semantics, exit codes, help text
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 15
- Forks
- 2
- Avg merge
- 1h 1m
- Merged PRs (30d)
- 27
Description
Symptom
CLI conventions have drifted across subcommands:
- Connection:
introspect/dump-cluster/dump-sqltake-host/-port/-user/-password/-secureflags;diffaccepts only aclickhouse://URI. - Output:
introspect/loaduse-out,dump-clusteruses-out-dir. -leftmeans "one of two diff operands" indiffbut "the schema to edit" insql2hcl.- Exit codes: usage errors are sometimes
os.Exit(1), sometimesos.Exit(2)for the same class (e.g. hclexp.go:218 vs :333). - Per-subcommand
-his bare Go flag output — no description or examples; only the top-levelusage()has prose.
Impact
Users must relearn flag conventions per subcommand; scripts can't rely on exit codes.
Fix direction
Pick one connection convention (support both URI and flags everywhere via a shared flag group), unify -out, standardize exit codes (2 = usage, 1 = runtime), and give each FlagSet a Usage func with a one-line description + example.
Found in the 2026-07-02 deep-dive audit (docs/plans/2026-07-02-deep-dive-improvement-areas.md, C4).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with hclexp.go, especially the inconsistent exit paths around lines 218 and 333, and review docs/plans/2026-07-02-deep-dive-improvement-areas.md for the C4 audit context. Trace each subcommand's FlagSet and connection, output, and -left handling before choosing shared conventions. Done means all subcommands follow the selected flags, exit codes, and per-command help format, with examples and behavior verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clickhouse, go
- Domain
- cli, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100