twolfson / sexy-bash-prompt

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

Allow for overriding git status symbols #41

Closed twolfson closed 10 years ago

twolfson commented 10 years ago

I encountered a scenario when the current set of git symbols are incomprehensible/inaccurate. Inside of a getty session (ctrl+alt+f1 on a Linux machine). It made me realize we should add some form of detection for support (not sure if possible) and allow for overriding.

getty git status

twolfson commented 10 years ago

For reference, I used snapscreenshot to capture the image which I found after a quick Google search.

rpdelaney commented 10 years ago

In linux you can test if you're in a tty by doing `if [[ $"TERM" = "linux" ]]; then``.

Of course, some crazy person could set their TERM to linux although they're not in a tty. But they shouldn't.

rpdelaney commented 10 years ago

That saiid, I suspect your problem might be a result of your local font configuration. The fonts used in a framebuffer must support the unicode space we use, but I believe they don't by default. I'll see if I can duplicate and then fix this issue and report back.

twolfson commented 10 years ago

Yep, while $TERM might have the info we want we should always rely on feature detection (e.g. tput) over environment detection. If we can't do that, then we should implement overrides and add documentation for non-unicode overrides.

twolfson commented 10 years ago

Okay, I have generated a list of all valid unicode characters and walked through them in getty.

https://github.com/twolfson/sexy-bash-prompt/blob/2bd9e006d813489bd41ebb0245f97dad669d6db2/explore-unicode.bash#L43-L91

It looks like there are arrows in high range and as greek characters. I would prefer to document the high range arrows and ASCII alternatives:

# High range arrows
dirty unpushed: *↑
dirty unpulled: *↓
dirty unpushed unpulled: *↑↓

# ASCII only
dirty unpushed: *^
dirty unpulled: *v
dirty unpushed unpulled: *^v
twolfson commented 10 years ago

Have you started on the override branch or only exploring font detection? If you haven't done the override, I would like to implement that since it should be quite straight forward.

twolfson commented 10 years ago

I uploaded the files to the following gist:

WARNING: The gist has 64k lines of output so it might hang your browser

https://gist.github.com/twolfson/9cc7968eb6ee8b9ad877

rpdelaney commented 10 years ago

Nope, nothing yet. Go for it.

twolfson commented 10 years ago

1 PR coming up

twolfson commented 10 years ago

Resolved in 0.23.0

twolfson commented 9 years ago

Another case for our resolution of whether a font supports specific characters can be found in #50 which is X11 forwarding on a Docker container.