diff --git a/functions.sh b/functions.sh index ef7894b..b8e9961 100755 --- a/functions.sh +++ b/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/$@ ;}