Skip to content
Snippets Groups Projects
Commit 399c89c0 authored by Vincent Le gallic's avatar Vincent Le gallic
Browse files

En fait on n'a pas besoin que cette fonction soit commentée.

parent ccbce1e7
No related branches found
No related tags found
No related merge requests found
......@@ -37,58 +37,58 @@ fi
[ -d ~/.bash_completion.d/ ] && for f in ~/.bash_completion.d/*; do source $f; done
#~# # +-----+
#~# # | VCS |
#~# # +-----+
#~#
#~# # Définition de fonction pour pouvoir afficher dans le prompt
#~# # des infos quand on est dans un dépôt versionné
#~#
#~# find_up () {
#~# path="$1"
#~# shift 1
#~# while [[ "`readlink -f -- \"$path\"`" != "/" ]];
#~# do
#~# find "$path" -maxdepth 1 -mindepth 1 "$@"
#~# path=${path}/..
#~# done
#~# }
#~#
#~# get_vcs_info () {
#~# # Donne les infos sur le dépôt VCS courant.
#~# local LBRANCH LTYPE BRANCH TYPE DIR
#~# declare -a DIR
#~# declare -A TYPE
#~# declare -A BRANCH
#~# DIR[0]=".git"
#~# DIR[1]=".hg"
#~# DIR[2]="_darcs"
#~# DIR[3]=".svn"
#~# TYPE[.git]="git"
#~# TYPE[.hg]="mercurial"
#~# TYPE[_darcs]="darcs"
#~# TYPE[.svn]="svn"
#~# BRANCH[.git]='git branch 2>/dev/null | sed -r "s/^[^*].*$//" | paste -s -d "" | sed -r "s/^[*] //"'
#~# BRANCH[.hg]='hg branch 2>/dev/null'
#~# BRANCH[_darcs]="darcs show repo 2>/dev/null| egrep '^ *Cache' | sed 's@.*/\([^/]*\),.*@\1@'"
#~# BRANCH[.svn]="svn info 2>/dev/null | head -n 6 | tail -n 1"
#~#
#~# DIR=$(eval "find_up \"$PWD\" -name \"\"$(printf -- ' -o -name "%s"' "${DIR[@]}") | head -n 1")
#~# if [ -n "$DIR" ]; then
#~# DIR=$(basename "$DIR")
#~# LBRANCH=$(eval "${BRANCH[$DIR]}")
#~# LTYPE="${TYPE[$DIR]}"
#~# if [ "$color_prompt" = yes ]; then
#~# VCS_info="${nocolor}${vcs_symbols_color}(${nocolor}$LTYPE${vcs_symbols_color})-${vcs_symbols_color}[${vcs_branch_color}$LBRANCH${vcs_symbols_color}]${nocolor}"
#~# else
#~# VCS_info="($LTYPE)-[$LBRANCH]"
#~# fi
#~# VCS_size=$((${#LTYPE}+${#LBRANCH}+5))
#~# else
#~# VCS_info=""
#~# VCS_size=0
#~# fi
#~# }
# +-----+
# | VCS |
# +-----+
# Définition de fonction pour pouvoir afficher dans le prompt
# des infos quand on est dans un dépôt versionné
find_up () {
path="$1"
shift 1
while [[ "`readlink -f -- \"$path\"`" != "/" ]];
do
find "$path" -maxdepth 1 -mindepth 1 "$@"
path=${path}/..
done
}
get_vcs_info () {
# Donne les infos sur le dépôt VCS courant.
local LBRANCH LTYPE BRANCH TYPE DIR
declare -a DIR
declare -A TYPE
declare -A BRANCH
DIR[0]=".git"
DIR[1]=".hg"
DIR[2]="_darcs"
DIR[3]=".svn"
TYPE[.git]="git"
TYPE[.hg]="mercurial"
TYPE[_darcs]="darcs"
TYPE[.svn]="svn"
BRANCH[.git]='git branch 2>/dev/null | sed -r "s/^[^*].*$//" | paste -s -d "" | sed -r "s/^[*] //"'
BRANCH[.hg]='hg branch 2>/dev/null'
BRANCH[_darcs]="darcs show repo 2>/dev/null| egrep '^ *Cache' | sed 's@.*/\([^/]*\),.*@\1@'"
BRANCH[.svn]="svn info 2>/dev/null | head -n 6 | tail -n 1"
DIR=$(eval "find_up \"$PWD\" -name \"\"$(printf -- ' -o -name "%s"' "${DIR[@]}") | head -n 1")
if [ -n "$DIR" ]; then
DIR=$(basename "$DIR")
LBRANCH=$(eval "${BRANCH[$DIR]}")
LTYPE="${TYPE[$DIR]}"
if [ "$color_prompt" = yes ]; then
VCS_info="${nocolor}${vcs_symbols_color}(${nocolor}$LTYPE${vcs_symbols_color})-${vcs_symbols_color}[${vcs_branch_color}$LBRANCH${vcs_symbols_color}]${nocolor}"
else
VCS_info="($LTYPE)-[$LBRANCH]"
fi
VCS_size=$((${#LTYPE}+${#LBRANCH}+5))
else
VCS_info=""
VCS_size=0
fi
}
# Pour avoir le bon umask en fonction du dossier où on se trouve
......@@ -165,7 +165,8 @@ function prompt_command
local pwd ERR DATE PROMPT DIR POST_DIR
(( SAVE_COLUMNS == COLUMNS )) || gen_minus_line
#~# #dépend de la section VCS
#~# # À décommenter si on veut des infos
#~# # quand on se trouve dans un dépôt versionné
#~# get_vcs_info
pwd=${PWD/#$HOME/'~'}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment