psysh
psysh copied to clipboard
Improves console output
After https://github.com/laravel/tinker/pull/152, as requested, I've made this pull request that updates the console output of the shell class. Here are the changes, and feel free to "check" the ones you agree with, and leave uncheck the changes you think still need some discussion.
- [x] As requested, we've left the library's author name unchanged, and simply updated the color from "blue" to "cyan".
- [ ] Next, the
PROMPT,BUFF_PROMPT,REPLAY, andRETVAL, have been simplified to a singlechar. Also, theRETVALis displayed ongray`, so the output result gets highlighted. - [ ] After, when errors/warnings occur, I've added margin-top and margin-bottom ( a new line ), so the terminal has some space to breathe.
- [x] Also, the "Goodbye" message, or any message coming from "BreakException" are now displayed as regular "INFO" information, as they are not errors.
- [x] Next, I've displayed the errors differently, using a "CLASS_NAME" followed by the original message for regular exceptions, and using "ERROR_TYPE" followed by the original message for PHP errors/warnings.
- [x] I've removed the "in Psy Shell code" wording, as it doesn't add anything.
- [x] Finally, I've ensured error/warnings messages always end with a "dot", and contain relative paths instead of absolute paths.
Here is the described changes, but comparing the before vs after:
Hi @bobthecow, so, here is the list of applied changes, after your first feedback in the pull request:
- The
on line 1is only displayed whenline > 1:
-
Named styles - the
blueinfo background and thegraything - got converted to "named" styles:infoandwhisper. Note that, thewhisperonly actually usesgrayifgrayis available. -
The
⏎symbol now uses thewhisperstyle. ( can you test this one? ). -
The credits are displayed on
whisper:
The ⏎ symbol now uses the whisper style. ( can you test this one? ).
This happens when stdout doesn't end with a newline, so you can test with echo "foo".
@bobthecow Ready for your second review. ✅
Do you know why a few jobs are failing?
@nunomaduro it's caused by indentation of closing HEREDOC (EOF). Relaxed syntax was introduced in 7.3 and that's why those versions are green in Actions 🙂
@bobthecow Let me know if something else is missing here. ✔️
Sorry, I've been camping and unable to connect to the internet. I'll take a look soon :)
Perfect. No worries, and be sure to enjoy your camping. 🏕
How do we feel about whispering the prompt as well?
Thanks for all your work on this :)