Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
|
Oooh, this is nice! The trailing Also, maybe |
|
regarding the |
|
Could you add a PR description on how this differs from the built in confirm() for more clarity? |
kt3k
left a comment
There was a problem hiding this comment.
Can you also add export entry in deno.json?
| } | ||
|
|
||
| /** Default values for the confirm prompt. */ | ||
| export const YES_NO_VALUES: PromptConfirmValue<boolean>[] = [ |
There was a problem hiding this comment.
If this is the default for values, then maybe values should be a part of the option bag? (and it also can be omitted?)
bartlomieju
left a comment
There was a problem hiding this comment.
Nice addition. A few things to address:
- Missing export in
deno.json(as @kt3k noted). - The
defaultoption hardcodes"n"as fallback — this is y/n-specific and doesn't work well with custom values. Consider defaulting tovalues[0].keyinstead. - Invalid input silently returns the default rather than re-prompting. This seems surprising — a typo would be silently accepted. Consider looping on invalid input.
- If
options.defaultdoesn't match any value key, it silently falls back tovalues[0]with no error. Should validate upfront. - Missing
@experimentaltags on the exported function and types. - JSDoc examples reference
@std/cli/unstable-confirmbut the export path would be@std/cli/unstable-prompt-confirm.
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.