#####
# External utilities
-DIFF=$(which diff)
-GIT=$(which git)
-LN=$(which ln)
-MV=$(which mv)
-PATCH=$(which patch)
-SED=$(which sed)
-RM=$(which rm)
-RSYNC=$(which rsync)
-TAR=$(which tar)
-TOUCH=$(which touch)
-WGET=$(which wget)
+DIFF=${DOTFILES_DIFF:-$(which diff)}
+GIT=${DOTFILES_GIT:-$(which git)}
+LN=${DOTFILES_LN:-$(which ln)}
+MV=${DOTFILES_MV:-$(which mv)}
+PATCH=${DOTFILES_PATCH:-$(which patch)}
+SED=${DOTFILES_SED:-$(which sed)}
+RM=${DOTFILES_RM:-$(which rm)}
+RSYNC=${DOTFILES_RSYNC:-$(which rsync)}
+TAR=${DOTFILES_TAR:-$(which tar)}
+TOUCH=${DOTFILES_TOUCH:-$(which touch)}
+WGET=${DOTFILES_WGET:-$(which wget)}
#####
# Compatibility checks
cat <<-EOF
- usage: $0 ${COMMAND} [REPO]
+ usage: $0 ${COMMAND} [options] [REPO]
Where 'REPO' is the name the dotfiles repository to update.
If it is not given, all repositories will be updateed.
to bring them in sync with the central repositories. Keeps track
of the last update time to avoid multiple fetches in the same
week.
+
+ ${COMMAND} passes any options it receives through to the link
+ command.
EOF
}
function update()
{
+ LINK_OPTS=''
+ while [ "${1::2}" = '--' ]; do
+ LINK_OPTS="${LINK_FN_OPTS} ${1}"
+ shift
+ done
# multi-repo case handled in main() by run_on_all_repos()
REPO=$(nonempty_option 'update' 'REPO' "${1}") || return 1
maxargs 'disconnect' 1 "${@}" || return 1
"${TOUCH}" "${UPDATE_FILE}" || return 1
fetch "${REPO}" || return 1
patch "${REPO}" || return 1
- link "${REPO}" || return 1
+ link ${LINK_OPTS} "${REPO}" || return 1
echo "${REPO} dotfiles updated"
fi
}