Skip to content

feat(cli/unstable): add promptConfirm#6985

Open
crowlKats wants to merge 2 commits intomainfrom
promptconfirm
Open

feat(cli/unstable): add promptConfirm#6985
crowlKats wants to merge 2 commits intomainfrom
promptconfirm

Conversation

@crowlKats
Copy link
Member

@crowlKats crowlKats commented Feb 5, 2026

adds a promptConfirm function, which is similar to the built-in confirm, however provides more flexibility with letting users decide what the options are, and what the default value is.

@crowlKats crowlKats requested a review from kt3k as a code owner February 5, 2026 10:53
@github-actions github-actions bot added the cli label Feb 5, 2026
@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 93.05556% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.20%. Comparing base (1cd85bf) to head (b49a969).

Files with missing lines Patch % Lines
cli/unstable_prompt_confirm.ts 93.05% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6985      +/-   ##
==========================================
- Coverage   94.20%   94.20%   -0.01%     
==========================================
  Files         613      614       +1     
  Lines       47710    47782      +72     
  Branches     8299     8321      +22     
==========================================
+ Hits        44945    45011      +66     
- Misses       2697     2703       +6     
  Partials       68       68              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomas-zijdemans
Copy link
Contributor

tomas-zijdemans commented Feb 5, 2026

Oooh, this is nice!

The trailing $ on line 120, is that intentional? I might be reading this wrong (I see your tests expect them "Continue? [y$/N$] ").

Also, maybe readLineFromStdinSync could be reused from prompt_secret.ts

@crowlKats
Copy link
Member Author

regarding the $ that was a mistake on my end during experimenting that accidentally stayed in

@timreichen
Copy link
Contributor

Could you add a PR description on how this differs from the built in confirm() for more clarity?

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add export entry in deno.json?

}

/** Default values for the confirm prompt. */
export const YES_NO_VALUES: PromptConfirmValue<boolean>[] = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the default for values, then maybe values should be a part of the option bag? (and it also can be omitted?)

@kt3k kt3k changed the title feat(cli): add promptConfirm feat(cli/unstable): add promptConfirm Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants