Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # bash docker-machine prompt support
- #
- # To enable:
- #
- # 1) Copy this file to somewhere (e.g. ~/.docker-machine-prompt.sh).
- # 2) Add the following line to your .bashrc/.zshrc:
- # source ~/.docker-machine-prompt.sh
- # 3) Change your PS1 to call __docker_machine_name_ps1 as
- # command-substitution:
- # Bash: PS1='[\u@\h \W$(__docker_machine_name_ps1 " (%s)")]\$ '
- # the optional argument will be used as format string.
- #
- #PS1='[\u@\h \W]$(__git_ps1 "[\[\033[32m\]%s\[\033[0m\]]")$(__docker_machine_name_ps1 "[\[\033[32m\]%s\[\033[0m\]]")\$ '
- #
- __docker_machine_name_ps1()
- {
- local printf_format=' (%s)'
- case "$#" in
- 0|1) printf_format="${1:-$printf_format}"
- ;;
- *) return
- ;;
- esac
- [ -f Dockerfile ] && printf "$printf_format" "$DOCKER_MACHINE_NAME"
- [ -f docker-compose.yml ] && printf "$printf_format" "$DOCKER_MACHINE_NAME"
- }
- #__END__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement