Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- parse_git_branch() {
- git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
- }
- kube_context() {
- kubectl config current-context
- }
- kube_namespace() {
- 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'
- }
- export CNS=$(kube_context)
- export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[01;32m\] [ \$(kube_context)(\$(kube_namespace)) ]\[\033[00m\]$ "
- #if [ -f "/usr/local/opt/bash-git-prompt/share/gitprompt.sh" ]; then
- # __GIT_PROMPT_DIR="/usr/local/opt/bash-git-prompt/share"
- # source "/usr/local/opt/bash-git-prompt/share/gitprompt.sh"
- #fi
- if [ -f $(brew --prefix)/etc/profile.d/bash_completion.sh ]; then
- . $(brew --prefix)/etc/profile.d/bash_completion.sh
- fi
- source <(kubectl completion bash)
- # The next line updates PATH for the Google Cloud SDK.
- if [ -f '/Users/ichtar/Downloads/google-cloud-sdk/path.bash.inc' ]; then source '/Users/ichtar/Downloads/google-cloud-sdk/path.bash.inc'; fi
- # The next line enables shell command completion for gcloud.
- if [ -f '/Users/ichtar/Downloads/google-cloud-sdk/completion.bash.inc' ]; then source '/Users/ichtar/Downloads/google-cloud-sdk/completion.bash.inc'; fi
- alias k=kubectl
- alias kctx=kubectx
- alias kns=kubens
- complete -o default -F __start_kubectl k
- complete -o default -o nospace -F __start_kubectl k
- # Setup cdg function
- # ------------------
- unalias cdg 2> /dev/null
- cdg() {
- home=~
- local dest_dir=$(cdscuts_glob_echo | fzf )
- [[ dest_dir =~ "^~" ]] && dest_dir=$(echo $dest_dir|sed "s|~|$home|")
- if [[ $dest_dir != '' ]]; then
- cd $dest_dir
- fi
- }
- export -f cdg > /dev/null
- . completion.bash
- . key-bindings.bash
- export LANG=en_US.UTF-8
- export PATH=~/Library/Python/3.7/bin:$PATH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement