#!/usr/bin/env bash

VENDOR_LOCATION=''

for i in "$@" 
do
case $i in 
    -l=*|--location=*)
    VENDOR_LOCATION="${i#*=}"
    shift
    ;;
    -h)
    echo Usage: execute with no trailing slash ./recpull.sh -l="{path_to_dir}" 
    exit
esac
done

if [ -d $VENDOR_LOCATION ]; then
    cd $VENDOR_LOCATION
else
    echo 'Please specify vendor directory location!'
    exit
fi

for f in $VENDOR_LOCATION/* 
do
    if [ -d ${f} ]; then
        # Will not run if no directories are available
        echo Pulling latest on $f;
	git pull;
    fi
done