Commit 53324fa3 authored by Valentin Samir's avatar Valentin Samir

[bash_completion] Get rid of contain function

parent dae7b30c
# Fonction de notre auto completion
contain(){
local i
for i in $2; do
if [[ "$i" = "$1" ]]; then
return 0
fi
done
return 1
}
if [[ "$EDITOR" = "" ]]; then
export EDITOR="nano";
fi
......@@ -18,7 +7,7 @@ fi
_cranspasswords(){
# declaration des variables locales
local argc first last prev cur cur_first_char opts_short opts role_dir pass_dir server server_list role_list pass_list timeout
role_dir="/tmp/cranspasswords-$USER-role/"
pass_dir="/tmp/cranspasswords-$USER-passwords/"
# Combien de temps on garde les réponses du serveur en cache (en minutes)
......@@ -46,7 +35,7 @@ _cranspasswords(){
find "$pass_dir" -type f -mmin +$timeout -exec rm -f {} \;
# On détermine si on utilsie un serveur alternatif
if contain "--server" "${COMP_WORDS[*]}"; then
if [[ "${COMP_WORDS[*]}" = *" --server "* ]]; then
if [[ "$prev" = "--server" ]]; then
_cranspasswords_server=$last;
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment