go-prompt

command module
v0.0.0-...-be4f2cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2020 License: MIT Imports: 9 Imported by: 0

README

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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL