Skip to content

cmd/star/cli duplicates cmd/internal/cli, and the two now disagree on the flag surface #743

Closed

Description

@David-Noble-at-work

cmd/star/cli is a second copy of cmd/internal/cli. The two have already diverged, and after #740's Phase 1
they contradict each other on the flag surface every program is supposed to share.

The duplication

Eighteen exported names exist in both packages:

AddOutputFlags, Error, ExitCantCreate, ExitCode, ExitDataErr, ExitError, ExitIOErr,
ExitNoInput, ExitNoPerm, ExitOK, ExitSoftware, ExitUnavailable, ExitUsage, ExitWith, Failure,
Note, Success, Warn

cmd/star/cli/output.go is 387 lines; cmd/internal/cli/output.go is 196. The copy is not stale — it grew.

They now disagree

cmd/internal/cli cmd/star/cli
Flags bound --filter, --jq, --output/-o, --store, --template --format, --filter
Options type SinkOptions OutputFlags
Registration PersistentFlags() — inherited by every subcommand Flags() — the one command only
Renderer result.Pipeline over pkg/result + pkg/sink its own renderTable and format switch

star is one of the four programs #740 requires to share the common set. It cannot, while it binds a
different set from a different package.

renderTable is wanted, not deleted

cmd/star/cli/output.go:159 implements a table renderer. #740's Phase 4 calls for exactly one
TableFormatter in pkg/result, and #741 records that lore's hand-rolled table truncates by byte count.
This implementation is the candidate to promote, not to discard — Phase 4 is a move plus a rune-safety
fix, not a fresh write.

Scope

The only consumer is cmd/star/main.go, so the consolidation is contained: promote renderTable into
pkg/result, point star at cmd/internal/cli, and delete the duplicate package.

Acceptance

Plan and design documents

Kind Document
Plan docs/plans/feature/743-star-adoption.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions