functions: add retry function

feature/improve-speed
bretello 2021-07-14 10:19:21 +02:00
parent b64781409c
commit 517cf45174
1 changed files with 10 additions and 1 deletions

View File

@ -290,8 +290,17 @@ fvim() {
fi
}
# retry command until it succeeds (waiting one second or $RETRY_INTERVAL)
function retry() {
local _retry_interval
if [[ -z "$RETRY_INTERVAL" ]]; then _retry_interval=1; else _retry_interval=$RETRY_INTERVAL; fi
until $@; do sleep $RETRY_INTERVAL; done
}
# Creats a gitignore for the given argument (e.g. python, cpp, etc)
function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@; }
# dotfiles user functions
if [[ -f $HOME/.dotfiles_functions ]]; then
source "$HOME/.dotfiles_functions"
fi
function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;}