replaced GBT with new PS1
This commit is contained in:
parent
7f8b5aa529
commit
3f2d0b1888
4
.bashrc
4
.bashrc
@ -23,8 +23,8 @@ fi
|
|||||||
[[ -x "$(command -v kubectl)" ]] && source <(kubectl completion bash)
|
[[ -x "$(command -v kubectl)" ]] && source <(kubectl completion bash)
|
||||||
[[ -x "$(command -v helm)" ]] && source <(helm completion bash)
|
[[ -x "$(command -v helm)" ]] && source <(helm completion bash)
|
||||||
|
|
||||||
# Go Bullet Train settings
|
# PS1 Prompt
|
||||||
[[ -f "$HOME/go/bin/gbt" ]] && [[ -f "$HOME/.gbt.sh" ]] && source "$HOME/.gbt.sh"
|
[[ -f "$HOME/.ps1.sh" ]] && source "$HOME/.ps1.sh"
|
||||||
|
|
||||||
|
|
||||||
[[ -f "$HOME/.functions.sh" ]] && source ~/.functions.sh
|
[[ -f "$HOME/.functions.sh" ]] && source ~/.functions.sh
|
||||||
|
37
.gbt.sh
37
.gbt.sh
@ -1,37 +0,0 @@
|
|||||||
export GBT_SHELL="$0"
|
|
||||||
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
|
||||||
export GBT__SSH_CATCH_PSEUDO_TERMINAL=true
|
|
||||||
export PS1='$(~/go/bin/gbt $?)'
|
|
||||||
export GBT_CARS='OS, Custom4, Git, Dir, Custom1, Custom2, Custom3, PyVirtEnv, Status, Sign'
|
|
||||||
export GBT_CAR_PYVIRTENV_FORMAT='{{ Icon }}'
|
|
||||||
export GBT_CAR_DIR_BG='dark_gray'
|
|
||||||
export GBT_CAR_DIR_DEPTH='3'
|
|
||||||
export GBT_CAR_STATUS_FORMAT=' {{ Code }} '
|
|
||||||
export GBT_CAR_SIGN_USER_TEXT=''
|
|
||||||
export GBT_CAR_CUSTOM1_TEXT_TEXT='MyDot: error'
|
|
||||||
export GBT_CAR_CUSTOM1_BG='red'
|
|
||||||
export GBT_CAR_CUSTOM1_DISPLAY_CMD="$HOME/.local/bin/dotfiles_gbt_status.sh check_error"
|
|
||||||
export GBT_CAR_CUSTOM1_TEXT_TEXT='.error!'
|
|
||||||
export GBT_CAR_CUSTOM2_BG='green'
|
|
||||||
export GBT_CAR_CUSTOM2_FG='black'
|
|
||||||
export GBT_CAR_CUSTOM2_TEXT_TEXT='.c'
|
|
||||||
export GBT_CAR_CUSTOM2_DISPLAY_CMD="$HOME/.local/bin/dotfiles_gbt_status.sh check_status"
|
|
||||||
export GBT_CAR_CUSTOM3_TEXT_TEXT='.p'
|
|
||||||
export GBT_CAR_CUSTOM3_BG='green'
|
|
||||||
export GBT_CAR_CUSTOM3_FG='black'
|
|
||||||
export GBT_CAR_CUSTOM3_DISPLAY_CMD="$HOME/.local/bin/dotfiles_gbt_status.sh check_push"
|
|
||||||
export GBT_CAR_CUSTOM4_TEXT_TEXT='T'
|
|
||||||
export GBT_CAR_CUSTOM4_BG='yellow'
|
|
||||||
export GBT_CAR_CUSTOM4_FG='black'
|
|
||||||
export GBT_CAR_CUSTOM4_DISPLAY_CMD="$HOME/.local/bin/todo_sh_status.sh"
|
|
||||||
#Kubernetes
|
|
||||||
export GBT_CAR_KUBECTL_FORMAT=' {{ Context }} '
|
|
||||||
#Prompt forward:
|
|
||||||
export GBT__SSH_IGNORE=(crs ap1 ap2 ap3 ap4)
|
|
||||||
export GBT__HOME="${HOME}/go/src/github.com/jtyr/gbt"
|
|
||||||
export GBT__CARS_REMOTE='OS, Hostname, Git, Dir, Status, Sign'
|
|
||||||
export GBT__THEME_SSH="${HOME}/.gbts_theme.sh"
|
|
||||||
source ~/go/src/github.com/jtyr/gbt/sources/gbts/cmd/local.sh
|
|
||||||
alias ssh='gbt_ssh'
|
|
||||||
alias sudo='gbt_sudo'
|
|
||||||
|
|
38
.ps1.sh
Normal file
38
.ps1.sh
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
function set_bash_prompt () {
|
||||||
|
local LAST_EXIT_STATUS=$?
|
||||||
|
local EXIT_STATUS=""
|
||||||
|
local Color_Off='\033[0m' # Text Reset
|
||||||
|
|
||||||
|
local COLOR_DIVIDER="\033[0;32m"
|
||||||
|
local COLOR_USERNAME="\[\e[34;1m\]"
|
||||||
|
local COLOR_USERHOSTAT="\[\e[34;1m\]"
|
||||||
|
local COLOR_HOSTNAME="\[\e[34;1m\]"
|
||||||
|
local COLOR_GITBRANCH="\[\e[33;1m\]"
|
||||||
|
local COLOR_VENV="\033[0;36m"
|
||||||
|
local PATH_COLOR="\033[0;37m"
|
||||||
|
|
||||||
|
if [[ $LAST_EXIT_STATUS != 0 ]];then
|
||||||
|
EXIT_STATUS="${COLOR_DIVIDER}<\033[1;37m\033[41m${LAST_EXIT_STATUS}${Color_Off}${COLOR_DIVIDER}>"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PS1="\n${COLOR_DIVIDER}┌──(${COLOR_USERNAME}\u${COLOR_USERHOSTAT}@${COLOR_HOSTNAME}\h${COLOR_DIVIDER})─[${PATH_COLOR}\w${COLOR_DIVIDER}]${EXIT_STATUS}"
|
||||||
|
PS1="$PS1${COLOR_GITBRANCH}$(__git_ps1)${COLOR_DIVIDER}"
|
||||||
|
# # Add git branch portion of the prompt"
|
||||||
|
# if ! git_loc="$(type -p "$git_command_name")" || [ -z "$git_loc" ]; then
|
||||||
|
# # Git is installed
|
||||||
|
# if [ -d .git ] || git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
|
||||||
|
# # Inside of a git repository
|
||||||
|
# GIT_BRANCH=$(git symbolic-ref --short HEAD)
|
||||||
|
# PS1="${PS1}:${COLOR_GITBRANCH}${GIT_BRANCH}${COLOR_DIVIDER}"
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
# Add Python VirtualEnv portion of the prompt, this adds ":venvname"
|
||||||
|
if ! test -z "$VIRTUAL_ENV" ; then
|
||||||
|
PS1="${PS1}(${COLOR_VENV}${VIRTUAL_ENV##*/}${COLOR_DIVIDER})"
|
||||||
|
fi
|
||||||
|
PS1="${PS1}\n${COLOR_DIVIDER}└─\$${Color_Off} "
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tell Bash to run the above function for every prompt
|
||||||
|
export PROMPT_COMMAND=set_bash_prompt
|
@ -1,18 +0,0 @@
|
|||||||
# Install GoBulleTrain,
|
|
||||||
# Highly configurable prompt builder for Bash, ZSH and PowerShell written in Go.
|
|
||||||
|
|
||||||
Make sure go directory exists:
|
|
||||||
file.directory:
|
|
||||||
- name: {{ salt['user.info']( pillar['username']).home }}/go
|
|
||||||
- user: {{ pillar['username'] }}
|
|
||||||
- group: users
|
|
||||||
- mode: "0755"
|
|
||||||
|
|
||||||
{% if not salt['file.directory_exists']('{}/go/src/github.com/jtyr/gbt'.format(salt['user.info']( pillar['username'] ).home )) %}
|
|
||||||
Go get GBT:
|
|
||||||
cmd.run:
|
|
||||||
- name: go get github.com/jtyr/gbt/cmd/gbt
|
|
||||||
- runas: {{ pillar['username'] }}
|
|
||||||
- env:
|
|
||||||
- GOPATH: {{ salt['user.info']( pillar['username']).home }}/go
|
|
||||||
{% endif %}
|
|
@ -2,7 +2,6 @@ base:
|
|||||||
'*':
|
'*':
|
||||||
- repositories
|
- repositories
|
||||||
- packages
|
- packages
|
||||||
- gbt
|
|
||||||
- vim
|
- vim
|
||||||
- firefox
|
- firefox
|
||||||
- sudo
|
- sudo
|
||||||
|
Loading…
Reference in New Issue
Block a user