Consolidate default arg parsing (#4224)

automerge
This commit is contained in:
Michael Vines
2019-05-08 19:12:43 -07:00
committed by Grimes
parent bba94c43b9
commit d486d2b8ce
3 changed files with 38 additions and 55 deletions

View File

@ -72,3 +72,20 @@ SOLANA_RSYNC_CONFIG_DIR=$SOLANA_ROOT/config
# Configuration that remains local
SOLANA_CONFIG_DIR=$SOLANA_ROOT/config-local
default_arg() {
declare name=$1
declare value=$2
for arg in "${args[@]}"; do
if [[ $arg = "$name" ]]; then
return
fi
done
if [[ -n $value ]]; then
args+=("$name" "$value")
else
args+=("$name")
fi
}