Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. # bash docker-machine prompt support
  2. #
  3. # To enable:
  4. #
  5. # 1) Copy this file to somewhere (e.g. ~/.docker-machine-prompt.sh).
  6. # 2) Add the following line to your .bashrc/.zshrc:
  7. # source ~/.docker-machine-prompt.sh
  8. # 3) Change your PS1 to call __docker_machine_name_ps1 as
  9. # command-substitution:
  10. # Bash: PS1='[\u@\h \W$(__docker_machine_name_ps1 " (%s)")]\$ '
  11. # the optional argument will be used as format string.
  12. #
  13. #PS1='[\u@\h \W]$(__git_ps1 "[\[\033[32m\]%s\[\033[0m\]]")$(__docker_machine_name_ps1 "[\[\033[32m\]%s\[\033[0m\]]")\$ '
  14. #
  15. __docker_machine_name_ps1()
  16. {
  17. local printf_format=' (%s)'
  18.  
  19. case "$#" in
  20. 0|1) printf_format="${1:-$printf_format}"
  21. ;;
  22. *) return
  23. ;;
  24. esac
  25.  
  26. [ -f Dockerfile ] && printf "$printf_format" "$DOCKER_MACHINE_NAME"
  27. [ -f docker-compose.yml ] && printf "$printf_format" "$DOCKER_MACHINE_NAME"
  28. }
  29. #__END__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement