go-prompt
A tiny Go program that generates my WSL bash prompt.
Example
You can try it out like this (note that this is actually colorized):
$ go run go-prompt.go 123 && echo
alinz@DESKTOP-NK6M18P in ~/code/go-prompt git:master errno:123
>
Setup
Run make install
and patch your .bashrc
like this (or see this example):
git diff HEAD~
diff --git a/.bashrc b/.bashrc
index 2e8200d..863c583 100644
--- a/.bashrc
+++ b/.bashrc
@@ -115,3 +115,10 @@ if ! shopt -oq posix; then
. /etc/bash_completion
fi
fi
+
+if [ -e ~/.local/bin/go-prompt ]; then
+ go_prompt() {
+ PS1="$(go-prompt $?)"
+ }
+ export PROMPT_COMMAND=go_prompt
+fi