Skip to content

refactor(cli): dedup handle plumbing + progress rendering#134

Merged
dfa1 merged 1 commit into
mainfrom
refactor/dedup-helpers
Jun 22, 2026
Merged

refactor(cli): dedup handle plumbing + progress rendering#134
dfa1 merged 1 commit into
mainfrom
refactor/dedup-helpers

Conversation

@dfa1

@dfa1 dfa1 commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Two real copy-paste dups in the CLI (no new thin abstractions — the per-command run() boilerplate is left as-is, it's too thin to wrap).

InspectCommand vs CliHandles

InspectCommand.describe and InspectCommand.open were byte-identical to CliHandles.describe/open. Promoted CliHandles.open → package-private openTarget and pointed InspectCommand at both; ~30 duplicated lines gone (+ trimmed now-unused imports).

Export/Import progress

clearProgress() was identical in both; the determinate bar in renderProgress was identical (Import just adds an indeterminate total < 0 branch). Extracted a small ProgressBar helper (render + clear):

  • Export passes ProgressBar::render directly and calls ProgressBar.clear().
  • Import keeps only its indeterminate-row-count branch, delegating the bar to ProgressBar.render.

Covered by a parameterized ProgressBarTest (0/50/100% + non-positive total + clear). Full cli+inspector suites green (181).

🤖 Generated with Claude Code

InspectCommand.describe/open were byte-identical copies of CliHandles
.describe/open: promote CliHandles.open to a package-private openTarget and
have InspectCommand reuse both, dropping ~30 duplicated lines.

renderProgress/clearProgress were duplicated across Export/ImportCommand
(clearProgress identical; the determinate bar identical, Import just adds an
indeterminate branch). Extract a small ProgressBar helper (render + clear);
Export passes ProgressBar::render directly, Import keeps only its
indeterminate-row-count branch. Covered by a parameterized ProgressBarTest.

No new thin abstraction over the per-command run() boilerplate — left as is.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dfa1 dfa1 force-pushed the refactor/dedup-helpers branch from e5070af to 56408d9 Compare June 22, 2026 20:04
@dfa1 dfa1 merged commit b557e57 into main Jun 22, 2026
6 checks passed
@dfa1 dfa1 deleted the refactor/dedup-helpers branch June 22, 2026 20: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.

1 participant