From 41b3be950978aa1012c8c67649ee807761739179 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 27 Sep 2012 09:17:11 -0400 Subject: [PATCH] Pass update() options through to link(). This makes it easy to customize linking behavior while still using update() and its fetch-avoidance. --- dotfiles.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index e797d7f..a1379a3 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -708,7 +708,7 @@ function update_help() 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. @@ -717,11 +717,19 @@ function update_help() 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 @@ -736,7 +744,7 @@ function update() "${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 } -- 2.26.2