docs(blog): reword rprompt text

This commit is contained in:
Jan De Dobbeleer 2024-07-23 08:33:38 +02:00 committed by Jan De Dobbeleer
parent dd74429a8c
commit 81d79a7e41

View file

@ -48,11 +48,10 @@ CLI call, so we could control the output more easily. It leveraged the use of th
is a hook that is executed before the prompt is printed. We would first print the [`rprompt`][rprompt] in the `PROMPT_COMMAND`, is a hook that is executed before the prompt is printed. We would first print the [`rprompt`][rprompt] in the `PROMPT_COMMAND`,
and then set the primary prompt in the `PS1` variable so bash would not bother about the [`rprompt`][rprompt] being there. and then set the primary prompt in the `PS1` variable so bash would not bother about the [`rprompt`][rprompt] being there.
This approach was a lot **cleaner from an achitectural point of view**, but it had some downsides. This approach was a lot **cleaner from an achitectural point of view**, but it came with its own challenges.
The biggest downside was needing two CLI calls to print the prompt, which is not a big issue, The most obvious one is needing two CLI calls to print the prompt, which made rendering a bit slower than the first implementation.
but it was a bit slower than the first implementation.
Additionally, as we print before `PS1` is evaluated, it introduced the following issues: Additionally, as we print before `PS1` is evaluated, we noticed the following issues along the way:
1. when the output of the previous command didn't end with a newline, the [`rprompt`][rprompt] would be printed on the same line 1. when the output of the previous command didn't end with a newline, the [`rprompt`][rprompt] would be printed on the same line
as the output of the previous command as the output of the previous command
@ -61,13 +60,13 @@ Additionally, as we print before `PS1` is evaluated, it introduced the following
3. depending on the platform, it would still break command history navigation 3. depending on the platform, it would still break command history navigation
4. it required different logic for multiline prompts as we print before `PS1` and need to reposition the cursor correctly 4. it required different logic for multiline prompts as we print before `PS1` and need to reposition the cursor correctly
Of these issues, **only bullet 4 could be fixed**. Everything else was out of our control. Of these issues, **only bullet 4 could be fixed**. Everything else was outside of our control.
## Conclusion ## Conclusion
Oh My Posh is a tool that needs to be easy to use, maintain and be 100% reliable. One of the core principles of Oh My Posh is that it should Oh My Posh is a tool that needs to be easy to use, maintain and be 100% reliable. One of the core principles of Oh My Posh is that it should
**never break the shell**. The [`rprompt`][rprompt] feature in bash has never been reliable enough, and it was _hard to debug_ when it broke. **never break the shell**. The [`rprompt`][rprompt] feature in bash has never been reliable enough, and it was _hard to debug_ when it broke.
I have spent countless hours debugging issues with the [`rprompt`][rprompt] in bash, but it's **time to move on**. If you I spent countless hours debugging issues with the [`rprompt`][rprompt] in bash, but it's **time to move on**. If you
want to use the [`rprompt`][rprompt] feature, I would recommend using a shell that supports it natively, like [nushell], [zsh] or [fish]. want to use the [`rprompt`][rprompt] feature, I would recommend using a shell that supports it natively, like [nushell], [zsh] or [fish].
## What about Powershell? ## What about Powershell?