Skip to content

refactor(commands): extract shared extractFlag helper#133

Merged
mherod merged 1 commit into
mainfrom
refactor/extract-flag-helper
May 21, 2026
Merged

refactor(commands): extract shared extractFlag helper#133
mherod merged 1 commit into
mainfrom
refactor/extract-flag-helper

Conversation

@mherod
Copy link
Copy Markdown
Owner

@mherod mherod commented May 21, 2026

Summary

Dedupes the identical extractFlag helper across docs.ts, slides.ts, and sheets.ts. Moves it to src/utils/args.ts alongside parseAccount and normalizeArgs.

Closes #119.

What changed

  • src/utils/args.ts: Added extractFlag(args, flag).
  • src/commands/{docs,slides,sheets}.ts: Removed local extractFlag definitions; import from src/utils/args.ts.

Why

Three identical copies of a six-line helper. Mentioned during code review of #111/#112. Consolidating in args.ts keeps argument-parsing primitives together.

Testing

  • bun test --concurrent → 277/277 pass
  • bunx tsc --noEmit → clean
  • bun run lint → clean

Risk / Rollout

Zero. The helper body is byte-identical to the three deleted copies; normalizeArgs at the CLI entry already handles --flag=value before this helper is called.

Move the duplicated extractFlag helper from docs.ts, slides.ts, and
sheets.ts into src/utils/args.ts. The three local definitions were
identical and have been removed in favor of a single import.

Closes #119
@mherod mherod merged commit a0ded69 into main May 21, 2026
1 check passed
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.

refactor(commands): extract shared extractFlag helper

1 participant