-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat(@inquirer/core): Pass status to usePrefix
/theme.message
+ Change default prefix
#1544
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1544 +/- ##
=======================================
Coverage ? 97.78%
=======================================
Files ? 39
Lines ? 2391
Branches ? 644
=======================================
Hits ? 2338
Misses ? 46
Partials ? 7 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts on changing the default prefix?
packages/core/src/lib/theme.mts
Outdated
* (text, status) => colors.bold(text) | ||
* ``` | ||
*/ | ||
message: (text: string, status: string) => string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's give status
specific allowed strings. (and everywhere relevant, there's quite a few so I won't call them all 😅 )
packages/core/src/lib/use-prefix.mts
Outdated
theme, | ||
}: { | ||
isLoading?: boolean; | ||
status?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's give status
specific allowed strings.
I think Also, I wholeheartedly agree about giving |
|
`'pending'` is replaced by `'idle'`, as per SBoudrias#1544 (comment).
The new default prefix is a blue question mark (`?`) if the status of the prompt is not `'done'`, and a green heavy check mark (`✔`, U+2714) if the status of the prompt is `'done'`.
@SBoudrias I guess changing the default prefix means that we should also update the screenshots in the READMEs — however, I'm not sure what the setup / workflow there is (theme, font, etc.). |
Thanks for the work you've put on that PR! I went ahead a made a few adjustments before merging (just an FYI):
|
usePrefix
and style.message
(#1537)usePrefix
/theme.message
+ Change default prefix
About the screenshots, they were first introduced in #625... Feel free to regenerate screenshot and document a reproducible process in the CONTRIBUTING.md doc! (not sure if the same will work out of the box today 😬 - it's from 2018) |
This PR includes 5 commits:
.DS_Store
to.gitignore
for better DX on macOSstatus
tousePrefix
(instead ofisLoading
). Also updates references toisLoading
in README. This allows for behavior like the one described in I want to change prefix after answered. #1537 to be implemented by the user.status
tostyle.message
function as a second argument. This allows for behavior like the one described in I want to change prefix after answered. #1537 (comment) to be implemented by the user.Theme
type (via localDefaultTheme
type). This should improve IntelliSense.status
property passed tousePrefix
works as expected.What's missing is a unit test for the changes to
style.message
. However, I couldn't immediately find unit tests forstyle.message
to use as a template, and I didn't want to write one from scratch, since I'm not familiar with the setup. I tested the newstyle.message
functionality locally viacorepack yarn demo
, and there it seemed to work fine.Closes #1537.