28 lines
901 B
Bash
28 lines
901 B
Bash
# Git
|
|
parse_git_branch() {
|
|
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
|
|
}
|
|
|
|
# Docker context
|
|
function docker_context_prompt() {
|
|
local docker_context=$(docker context show 2> /dev/null)
|
|
# Vérifie si le contexte est "default" et ajuste l'affichage en conséquence
|
|
if [[ "$docker_context" == "default" ]]; then
|
|
echo " "
|
|
elif [[ -n "$docker_context" ]]; then
|
|
echo "($docker_context)"
|
|
fi
|
|
}
|
|
|
|
# Créer avec https://ezprompt.net/
|
|
export PS1="\n\[\e[37m\]\A\[\e[m\] \[\e[31m\]\h\[\e[m\] \[\e[34m\]\u\[\e[m\] [ \w ] \[\e[35m\]\`parse_git_branch\` \e[36m\]\`docker_context_prompt\`\[\e[m\]\n ~> "
|
|
|
|
# Alias
|
|
alias fastfetch='fastfetch -l /home/${USER}/.config/fastfetch/ASCII/gandalf.txt --color white'
|
|
alias rm="rm -i"
|
|
alias rmdir="rm -rf --interactive=once"
|
|
alias rmrf="rm -rf --interactive=once"
|
|
alias sudo="sudo "
|
|
|
|
fastfetch
|
|
cat /var/log/update.log |