Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fichiers_configuration
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Membres actifs
fichiers_configuration
Commits
867cc6af
Commit
867cc6af
authored
11 years ago
by
Valentin Samir
Browse files
Options
Downloads
Patches
Plain Diff
[bashrc] Color only if supported by term
parent
375893d0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.bashrc
+33
-8
33 additions, 8 deletions
.bashrc
with
33 additions
and
8 deletions
.bashrc
+
33
−
8
View file @
867cc6af
...
...
@@ -71,8 +71,11 @@ fi
#~# done
#~# if [ -n "$LTYPE" ];
#~# then
#~# echo $LTYPE
#~# VCS_info="${nocolor}${violet}(${nocolor}$LTYPE${violet})-${violet}[${vert}$LBRANCH${violet}]${nocolor}"
#~# if [ "$color_prompt" = yes ]; then
#~# VCS_info="${nocolor}${violet}(${nocolor}$LTYPE${violet})-${violet}[${vert}$LBRANCH${violet}]${nocolor}"
#~# else
#~# VCS_info="($LTYPE)-[$LBRANCH]"
#~# fi
#~# VCS_size=$((${#LTYPE}+${#LBRANCH}+5))
#~# else
#~# VCS_info=""
...
...
@@ -142,13 +145,29 @@ function prompt_command
DIR
=
$pwd
POST_DIR
=
'${MINUS_LINE:'
${#
pwd
}
+
${
VCS_size
}
+1
'+${#?}}'
fi
DIR
=
"<
${
jaune
}
"
$DIR
"
${
cyan
}
>"
ERR
=
'[ \[\e[1;$((31+($?==0)*6))m\]$?'
${
cyan
}
' ]'
$MINUS_CHAR
DATE
=
"(
${
violet
}
\D
{%H:%M:%S}
${
cyan
}
)"
PROMPT
=
"
${
rouge
}
\u
${
vert
}
@
${
bleu
}
\h
${
vert
}
\$
${
nocolor
}
"
PS1
=
$TITLE
${
cyan
}
$MINUS_CHAR$DATE$MINUS_CHAR$DIR$MINUS_CHAR$VCS_info
${
cyan
}
$POST_DIR$ERR
'\n'
$PROMPT
if
[
"
$color_prompt
"
=
yes
]
;
then
DIR
=
"<
${
jaune
}
"
$DIR
"
${
cyan
}
>"
ERR
=
'[ \[\e[1;$((31+($?==0)*6))m\]$?'
${
cyan
}
' ]'
$MINUS_CHAR
DATE
=
"(
${
violet
}
\D
{%H:%M:%S}
${
cyan
}
)"
PROMPT
=
"
${
rouge
}
\u
${
vert
}
@
${
bleu
}
\h
${
vert
}
\$
${
nocolor
}
"
PS1
=
$TITLE
${
cyan
}
$MINUS_CHAR$DATE$MINUS_CHAR$DIR$MINUS_CHAR$VCS_info
${
cyan
}
$POST_DIR$ERR
'\n'
$PROMPT
else
DIR
=
"< "
$DIR
" >"
ERR
=
'[ $? ]'
$MINUS_CHAR
DATE
=
"(
\D
{%H:%M:%S} )"
PROMPT
=
"
\u
@
\h
\$
"
PS1
=
$TITLE$MINUS_CHAR$DATE$MINUS_CHAR$DIR$MINUS_CHAR$VCS_info$POST_DIR$ERR
'\n'
$PROMPT
fi
}
if
[
-x
/usr/bin/tput
]
&&
tput setaf 1
>
&/dev/null
;
then
# support de la couleur
color_prompt
=
yes
else
# pas de support de la couleur
color_prompt
=
no
fi
# On change le titre de la fenêtre dynamiquement si on est sous X
if
[[
$TERM
=
"xterm"
]]
;
then
TITLE
=
'\[\e];\u@\h:\w\a\]'
...
...
@@ -169,9 +188,15 @@ if [[ $(uname) == Linux && ( $(locale charmap) == UTF-8 && $TERM != screen ) ]];
date
=
$(
/bin/date +
"%R, %A %d %B %Y"
)
redate
=
${
date
//é/e
}
redate
=
${
redate
//û/u
}
echo
-e
"
\e
[1;36m┬─
${
redate
//?/─
}
──┬
${
MINUS_LINE
:
${#
date
}
-18
}
\n\
if
[
"
$color_prompt
"
=
yes
]
;
then
echo
-e
"
\e
[1;36m┬─
${
redate
//?/─
}
──┬
${
MINUS_LINE
:
${#
date
}
-18
}
\n\
│
\e
[1;37m
$date
\e
[1;31m
\e
[1;36m │
\n\
└─
${
redate
//?/─
}
──┘
\e
[0m
\n
"
else
echo
-e
"┬─
${
redate
//?/─
}
──┬
${
MINUS_LINE
:
${#
date
}
-18
}
\n\
│
$date
│
\n\
└─
${
redate
//?/─
}
──┘
\n
"
fi
unset date
else
MINUS_CHAR
=
-
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment