prompt: Replace tput with escape codes
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
format_modified_detailed() {
|
||||
local txtrst='$(tput sgr0)'
|
||||
local txtrst='\e[m'
|
||||
local txtred='\e[0;31m'
|
||||
local txtgrn='$(tput setaf 2)'
|
||||
local txtyel='$(tput setaf 3)'
|
||||
local txtgrn='\e[0;32m'
|
||||
local txtyel='\e[0;33m'
|
||||
|
||||
# Modified, staged and untracked
|
||||
# A added (new file) M modified, D deleted, R renamed, T typechange
|
||||
@@ -27,10 +27,10 @@ format_modified_detailed() {
|
||||
}
|
||||
|
||||
format_modified() {
|
||||
local txtrst='$(tput sgr0)'
|
||||
local txtrst='\e[m'
|
||||
local txtred='\e[0;31m'
|
||||
local txtgrn='$(tput setaf 2)'
|
||||
local txtyel='$(tput setaf 3)'
|
||||
local txtgrn='\e[0;32m'
|
||||
local txtyel='\e[0;33m'
|
||||
|
||||
# Modified, staged and untracked
|
||||
# A added (new file) M modified, D deleted, R renamed, T typechange
|
||||
@@ -51,16 +51,16 @@ set_prompt_fancy()
|
||||
local is_git="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
|
||||
|
||||
local last_cmd=$?
|
||||
local txtrst='$(tput sgr0)'
|
||||
local txtbold='$(tput bold)'
|
||||
local txtblk='$(tput setaf 0)'
|
||||
local txtred='$(tput setaf 1)'
|
||||
local txtgrn='$(tput setaf 2)'
|
||||
local txtyel='$(tput setaf 3)'
|
||||
local txtblu='$(tput setaf 4)'
|
||||
local txtpur='$(tput setaf 5)'
|
||||
local txtcyn='$(tput setaf 6)'
|
||||
local txtwht='$(tput setaf 7)'
|
||||
local txtrst='\e[m'
|
||||
local txtbold='\e[1m'
|
||||
local txtblk='\e[30m'
|
||||
local txtred='\e[31m'
|
||||
local txtgrn='\e[32m'
|
||||
local txtyel='\e[33m'
|
||||
local txtblu='\e[34m'
|
||||
local txtpur='\e[35m'
|
||||
local txtcyn='\e[36m'
|
||||
local txtwht='\e[37m'
|
||||
# unicode "✗"
|
||||
local fancyx='\342\234\227'
|
||||
# unicode "✓"
|
||||
@@ -99,16 +99,16 @@ set_prompt()
|
||||
{
|
||||
local is_git="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
|
||||
|
||||
local txtrst='$(tput sgr0)'
|
||||
local txtbold='$(tput bold)'
|
||||
local txtblk='$(tput setaf 0)'
|
||||
local txtred='$(tput setaf 1)'
|
||||
local txtgrn='$(tput setaf 2)'
|
||||
local txtyel='$(tput setaf 3)'
|
||||
local txtblu='$(tput setaf 4)'
|
||||
local txtpur='$(tput setaf 5)'
|
||||
local txtcyn='$(tput setaf 6)'
|
||||
local txtwht='$(tput setaf 7)'
|
||||
local txtrst='\e[m'
|
||||
local txtbold='\e[1m'
|
||||
local txtblk='\e[30m'
|
||||
local txtred='\e[31m'
|
||||
local txtgrn='\e[32m'
|
||||
local txtyel='\e[33m'
|
||||
local txtblu='\e[34m'
|
||||
local txtpur='\e[35m'
|
||||
local txtcyn='\e[36m'
|
||||
local txtwht='\e[37m'
|
||||
|
||||
# User color: red for root, yel for others
|
||||
if [[ $EUID == 0 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user