Jens-Ulrik Petersen wrote:
> it now defaults to normal green and adds the
> red error code from Stephan (maybe this part could still be improved?)

I like the red error code enough that I'm trying it out on my own
workstation. Yet I doubt it's suitable for the default prompt. I'll
remember what it means because I've configured it myself. To a beginner
who hasn't configured their prompt, the intermittent appearance of a
red number will be very cryptic.

If the error code is included, then appending it to the working 
directory isn't the best choice. It looks like a part of the directory
name, especially to red/green blind users I expect. There should be a
space or other separator, but even then it could be ambiguous as
filenames can contain almost any characters. Writing the error code
before the username is less confusing. Users are unlikely to think that
the digits are part of their username.

This code expands to nothing if the exit code is zero, and to the exit
code followed by a space otherwise:

prompt_result_separator=' '
PS1='\[\e[0;31m\]${?#0}\[\e[0m\]${prompt_result_separator[!$?]}...'

Note also the "0;" in the beginning. I think all prompts should begin
with that to clear any attributes that may have been left behind by a
broken program. (Try "echo -e '\e[8m'" and see if it hides your prompt.)

Björn Persson

Attachment: pgp_JLupc3tON.pgp
Description: OpenPGP digital signatur

_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to