ajout cheat-sheet + completeion

This commit is contained in:
_N3m0 2023-03-04 12:48:25 +01:00
parent 4b585ed852
commit 2f70a014be
2 changed files with 30 additions and 0 deletions

View File

@ -21,3 +21,13 @@ complete -F cmpt_newp newp
# done
# }
# complete -F cmpt_prj prj
source ~/dev/script.download/git-completion.bash
__git_complete g git
cmpt_cs(){
for opt in `ls ~/dev/cheat-sheet`; do
COMPREPLY+=("$opt")
done
}
complete -F cmpt_cs cs

20
cs Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
if [[ $1 = "-l" ]]; then
ls ~/dev/cheat-sheet
exit
fi
if [[ $1 = "-ln" ]]; then
ln -s ~/dev/cheat-sheet/$2 $3
exit
fi
if [[ $1 = "-h" ]]; then
echo "cs -h : affiche commande"
echo "cs <cheat-sheet> : ouvre le cheat-sheet ou le crée s'il n'exite pas"
echo "cs -l : affiche liste cheat sheet"
echo "cs -ln <cheat-sheet> <lien> : crée un lien symbolique du cheat-sheet nommé lien"
exit
fi
nvim ~/dev/cheat-sheet/$1