git-graph

This commit is contained in:
_N3m0 2024-02-15 12:28:07 +01:00
parent 0934484046
commit 11ebc6d1ae
2 changed files with 55 additions and 2 deletions

5
bashrc
View File

@ -112,7 +112,7 @@ alias refresh="echo -e '\033[0m' '\033[?25h' '\033[?1049l'"
alias mpv="mpv --player-operation-mode=pseudo-gui --shuffle=yes"
alias space="echo -e '\033[?25l' && clear && read && echo -e '\033[?25h'"
alias lampp="sudo /opt/lampp/lampp"
alias clean="alias clr=\"clear\""
alias clean="alias clr=\"clear\" && clear"
alias oracle="cd ~/downloads/sqldeveloper/ && ./sqldeveloper.sh"
alias elephant="pqiv --fullscreen -ti ~/pictures/dall-e"
alias l="if [ \$(pwd) == \"\$HOME/dev\" ]; then lsprj; else ls $*; fi"
@ -125,7 +125,8 @@ alias todo="v $HOME/dev/opt/notes/TODO"
alias kys="shut"
alias lastcd="back && pwd && back"
alias sae="cd /opt/lampp/htdocs/SAE_Reseaux"
alias git-graph="gh graph"
alias unity="/home/cptbb/Unity-2023.2.8f1/Editor/Unity"
alias mantra="v $HOME/dev/opt/notes/mantra"
# alias avec parametre
emoji(){ grep -i $1 ~/documents/emoji; }

52
git-graph Executable file
View File

@ -0,0 +1,52 @@
#!/bin/bash
if [ -z $1 ]; then
user=CaptainBoulbi;
else
user=$1;
fi;
tab=$(curl --silent https://github.com/$user | grep contribution-day-component | cut -d' ' -f25,26 | sed "s/^id=\"contribution-day-component-//" | sed "s/\" data-level=\"/:/" | sed "s/-/:/" | sed "s/\"$//" | sed "/^$/d")
CR="\033[0m"
C0="\033[48;2;22;27;34m"
C1="\033[48;2;14;68;41m"
C2="\033[48;2;0;109;50m"
C3="\033[48;2;38;166;65m"
C4="\033[48;2;57;211;83m"
CE="\033[41m"
line=0
for data in $tab; do
row=$(echo $data | cut -d':' -f1);
lev=$(echo $data | cut -d':' -f3);
if [[ $row -gt $line ]]; then
line=$line+1;
echo -e $CR;
fi
case $lev in
0)
echo -ne $C0 ' ';
;;
1)
echo -ne $C1 ' ';
;;
2)
echo -ne $C2 ' ';
;;
3)
echo -ne $C3 ' ';
;;
4)
echo -ne $C4 ' ';
;;
*)
echo -ne $CE ' ';
;;
esac
done
echo -e $CR;