SHARE
TWEET

Untitled

a guest May 19th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. parse_git_branch() {
  2.      git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
  3. }
  4. kube_context() {
  5.     kubectl config current-context
  6. }
  7. kube_namespace() {
  8.      gsed -n '/- context:/,/name:/{/namespace:/h;/name:/{x;G;s/\n//g;/namespace/p}}' ~/.kube/config|grep "name: `kube_context`$"|gsed -n 's/.*namespace: \([^ ]*\) .*/\1/p'
  9. }
  10.  
  11. export CNS=$(kube_context)
  12. export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[01;32m\] [ \$(kube_context)(\$(kube_namespace)) ]\[\033[00m\]$ "
  13. #if [ -f "/usr/local/opt/bash-git-prompt/share/gitprompt.sh" ]; then
  14. #  __GIT_PROMPT_DIR="/usr/local/opt/bash-git-prompt/share"
  15. #  source "/usr/local/opt/bash-git-prompt/share/gitprompt.sh"
  16. #fi
  17.  
  18.  
  19. if [ -f $(brew --prefix)/etc/profile.d/bash_completion.sh ]; then
  20.   . $(brew --prefix)/etc/profile.d/bash_completion.sh
  21. fi
  22. source <(kubectl completion bash)
  23.  
  24. # The next line updates PATH for the Google Cloud SDK.
  25. if [ -f '/Users/ichtar/Downloads/google-cloud-sdk/path.bash.inc' ]; then source '/Users/ichtar/Downloads/google-cloud-sdk/path.bash.inc'; fi
  26.  
  27. # The next line enables shell command completion for gcloud.
  28. if [ -f '/Users/ichtar/Downloads/google-cloud-sdk/completion.bash.inc' ]; then source '/Users/ichtar/Downloads/google-cloud-sdk/completion.bash.inc'; fi
  29.  
  30. alias k=kubectl
  31. alias kctx=kubectx
  32. alias kns=kubens
  33. complete -o default -F __start_kubectl k
  34. complete -o default -o nospace -F __start_kubectl k
  35.  
  36. # Setup cdg function
  37. # ------------------
  38. unalias cdg 2> /dev/null
  39. cdg() {
  40.    home=~
  41.    local dest_dir=$(cdscuts_glob_echo | fzf )
  42.    [[ dest_dir =~ "^~" ]] && dest_dir=$(echo $dest_dir|sed "s|~|$home|")
  43.    if [[ $dest_dir != '' ]]; then
  44.       cd $dest_dir
  45.    fi
  46. }
  47. export -f cdg > /dev/null
  48. . completion.bash
  49. . key-bindings.bash
  50. export LANG=en_US.UTF-8
  51. export PATH=~/Library/Python/3.7/bin:$PATH
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top