Select projects from positional arguments (closes #3)

This commit is contained in:
southerntofu 2020-04-19 08:36:19 -04:00
parent 2092f45303
commit 23ef11c2a3
1 changed files with 16 additions and 2 deletions

View File

@ -18,8 +18,22 @@ run() {
# So scripts can know we're still running (for autoupdater)
touch $BASEDIR/.LOCK
for project in $BASEDIR/*.source; do
p_name="$(basename $project .source)"
# Find targeted projects from args
PROJECTS=()
for arg in "$@"; do
[ -f $BASEDIR/$arg.source ] && PROJECTS+=("$arg")
# use elseif to match other arguments, so we can do else print arg not found
done
# If no project argument passed, default to all projects
if [[ ${#PROJECTS[*]} = 0 ]]; then
for project in $BASEDIR/*.source; do
# Extract the project name from path
PROJECTS+=("$(basename $project .source)")
done
fi
for p_name in ${PROJECTS[*]}; do
echo "[$p_name] START"
[ -f $BASEDIR/$p_name.branch ] && p_branch="$(cat $BASEDIR/$p_name.branch)" || p_branch="master"
p_dir="$BASEDIR/.$p_name"