[bash_completion] Get rid of contain function
This commit is contained in:
parent
dae7b30c7e
commit
53324fa30e
1 changed files with 2 additions and 13 deletions
|
@ -1,16 +1,5 @@
|
|||
# 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue