Skip to content

Instantly share code, notes, and snippets.

@artyom
Created November 18, 2016 09:47
Show Gist options
  • Save artyom/04bff2bd42d4ff0cece17ce21f3b1638 to your computer and use it in GitHub Desktop.
Save artyom/04bff2bd42d4ff0cece17ce21f3b1638 to your computer and use it in GitHub Desktop.
Show gopher when current working directory is under GOPATH
__pschar () {
IFS=':' read -ra PDIRS <<< "$GOPATH"
for P in "${PDIRS[@]}" ; do
test "${1#$P}" = "$1" || {
printf ""
return
}
done
printf "¶"
}
PS1='...$(__pschar "$PWD") '
pcd () { cd $(go list -f '{{.Dir}}' .../$1) ; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment