News for hackers. Stuff that matters.
Re:Bash PS1 Generator by Zhyl on Thursday June 24, 2021 @07:29AM (#27616135)
Notes:

* As an idea, this is excellent. It's intuitive to use and provides full instructions on how to implement

* Putting an element in any other position than the end of the prompt is fiddly.

* I'd love for the option to to be able to colour elements.

* More advanced or exotic element types such as Git Branch would be excellent (Not sure if Bash supports this, but I've seen it in some shells)

Re:Bash PS1 Generator by Jenk on Thursday June 24, 2021 @08:29AM (#27616528)
For the manual approach, git provides a shell script to generate the env var __git_ps1 for this very purpose.[1]

[1]: https://git-scm.com/book/id/v2/Appendix-A%3A-Git-in-Other-En...

Re:Bash PS1 Generator by teknopaul on Thursday June 24, 2021 @09:18AM (#27616976)
I think a manual approach is covered with vim ;)
Re:Bash PS1 Generator by cghendrix on Thursday June 24, 2021 @08:50AM (#27616729)
Very cool, had no idea!
Re:Bash PS1 Generator by dolmen on Thursday June 24, 2021 @08:15AM (#27616428)
See also:

* LiquidPrompt [0] (I'm a former maintainer)

* angel-PS1 [1]: my pet project. Shell prompt code is generated at startup time from Perl code, and uses a Perl angel (not daemon) to get system information.

[0] https://github.com/nojhan/liquidprompt

[1] https://github.com/dolmen/angel-PS1

Re:Bash PS1 Generator by Rayhem on Thursday June 24, 2021 @03:33PM (#27622739)
There's one prompt in ZSH, the adam2 prompt[1], that I completely fell in love with due to the automatic horizontal rule since it makes tracing histories so much easier when dealing with long-scrolling outputs. I've never been able to find a similar feature in another prompt/shell, nor have I had the inclination to try and replicate it, but I'd be much more inclined to switch shells/try new prompts if that were available.

[1]: https://imgur.com/1X9bY8X

Re:Bash PS1 Generator by indianboy42 on Friday June 25, 2021 @06:40AM (#27629066)
The tide prompt for fish has an option to add a horizontal rule and spaces between each command
Re:Bash PS1 Generator by phit_ on Thursday June 24, 2021 @07:31AM (#27616153)
double click an element to change the color
Re:Bash PS1 Generator by Zhyl on Thursday June 24, 2021 @09:07AM (#27616879)
Aha! Thank you!
Re:Bash PS1 Generator by dom111 on Thursday June 24, 2021 @08:46AM (#27616684)
I've shared it elsewhere too, but I made something similar a few years ago which provides what you were after:

https://dom111.github.io/bash-ps1/

Re:Bash PS1 Generator by dopidopHN on Thursday June 24, 2021 @07:35AM (#27616169)
Bash do support git branch name and whatnot. That what got me into PS1 customization.