justjanne / powerline-go

A beautiful and useful low-latency prompt for your shell, written in go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not display anything in the goenv segment if it's set at the default

scop opened this issue · comments

Quoting @arusso from #264 (comment):

it checks for go versions that aren't set in the shell

FWIW, this is exactly what I do not want. If I have my shell set at my goenv global default, I don't want my prompt cluttered by that default version, because I know it's the default, I don't need to be reminded about that in every prompt I see. It's quite likely I'm not even using anything golang related in that shell, so it's just noise. Only when I have set it to something besides the default, it's of importance and then I want it displayed in the prompt; in other words, only when GOENV_VERSION is set to something.

My current workaround is to use the plugin segment instead of the builtin goenv one, with mygoenv in modules, and powerline-go-mygoenv in $PATH with contents:

#!/bin/sh
test "${GOENV_VERSION-}" &&
	printf '[{"Content":"%s","Background":38,"Foreground":220}]' \
		"${GOENV_VERSION-}" ||
	echo '[]'

None of the other env segments I use (shenv, plenv, pyenv) work this way. I see rbenv does more than that (and I'm not using it), but I think I'm not alone in desiring not being parroted with the defaults, and would suggest the default being reverted to just taking a look at the env vars, perhaps optionally controlled by another powerline-go envvar or something that would opt-in for the lookup from other sources. (Or provide an opt-out setting to not get anything besides the envvars, but my biased opinion is that what I like would be the better default :))