twolfson / sexy-bash-prompt

Bash prompt with colors, git statuses, and git branches.
MIT License
1.14k stars 154 forks source link

Moved to PROMPT_COMMAND #88

Closed twolfson closed 4 years ago

twolfson commented 4 years ago

For #82, we needed to transition to PROMPT_COMMAND to properly capture the exit code of our last command. This will build out an updated PS1 to use for our prompt

The transition was straightforward for the prompt but a bit rocky for testing. To minimize PR noise, I figured we should break it out into its own PR

In this PR:

Notes:

For reference, here's the man page that confirms we're using PROMPT_COMMAND correctly, https://archive.vn/4HsIg#selection-5444.0-5444.2

If set, the value is executed as a command prior to issuing each primary prompt.

On previous attempts, I looked at blogs like this which dynamically echo'd out the prompt itself which was strange UX and felt off

https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x264.html

rpdelaney commented 4 years ago

Hey Todd! Lately I've got my hands full moving to a new apartment & doing battle with Comcast. I should be able to have a look at this sometime later this week, if that works for you.

By the way, I've been playing around with starship recently. You might want to have a look, if for nothing else than inspiration. :-)

twolfson commented 4 years ago

Later this week works fine for me =) Good luck on the move and minimal long wait times

Yea, I've seen starship -- sooo many options o_o To the point where my eyes glaze over =X Good inspiration though indeed =)