PostHog / PostHog/chschema

CLI consistency: connection flags vs URI, -out vs -out-dir, -left semantics, exit codes, help text

Open
#96 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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-sql take -host/-port/-user/-password/-secure flags; diff accepts only a clickhouse:// URI.
  • Output: introspect/load use -out, dump-cluster uses -out-dir.
  • -left means "one of two diff operands" in diff but "the schema to edit" in sql2hcl.
  • Exit codes: usage errors are sometimes os.Exit(1), sometimes os.Exit(2) for the same class (e.g. hclexp.go:218 vs :333).
  • Per-subcommand -h is bare Go flag output — no description or examples; only the top-level usage() 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.