sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

D1074.bashrc (1072B)


      1 # bashrc -*- mode: sh; mode: sh-bash -*-
      2 
      3 # test case from https://qiita.com/kxn4t/items/bd85397914a22e69cefd
      4 #source ~/.git-prompt.sh
      5 
      6 GIT_PS1_SHOWDIRTYSTATE=true
      7 GIT_PS1_SHOWUNTRACKEDFILES=true
      8 GIT_PS1_SHOWSTASHSTATE=true
      9 GIT_PS1_SHOWUPSTREAM="auto"
     10 
     11 # define for PS1
     12 black=$'\e[30m' # Black - Regular
     13 red=$'\e[31m' # Red
     14 green=$'\e[32m' # Green
     15 yellow=$'\e[33m' # Yellow
     16 blue=$'\e[34m' # Blue
     17 purple=$'\e[35m' # Purple
     18 cyan=$'\e[36m' # Cyan
     19 white=$'\e[37m' # White
     20 gray=$'\e[90m' # Gray
     21 reset=$'\e[m'
     22 
     23 # add new line after the output
     24 function add_line {
     25   if [[ -z "${PS1_NEWLINE_LOGIN}" ]]; then
     26     PS1_NEWLINE_LOGIN=true
     27   else
     28     printf '\n'
     29   fi
     30 }
     31 #PROMPT_COMMAND='add_line'
     32 
     33 function check_result_yunocchi {
     34   if [ $? -eq 0 ]; then
     35     face="\001${yellow}\002 ✖╹◡╹✖"
     36   else
     37     face="\001${red}\002 xX_Xx"
     38   fi
     39 
     40   echo -e "${face}\001${reset}\002 < "
     41 }
     42 
     43 # output prompt
     44 #prefix="\u \[$purple\]\w\[$reset\]\[$cyan\] "'$(__git_ps1 "(%s)")'"\[$reset\]\n"
     45 prefix="\u \[$purple\]\w\[$reset\]\[$cyan\] \[$reset\]\n"
     46 PS1="${prefix}"'$(check_result_yunocchi)'