mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-22 03:21:30 +01:00
functions: add retry function
This commit is contained in:
parent
b64781409c
commit
517cf45174
11
functions.sh
11
functions.sh
|
@ -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/$@ ;}
|
||||
|
|
Loading…
Reference in New Issue
Block a user