From fcec63ef959389f875e223a3657ff4fe27b7b655 Mon Sep 17 00:00:00 2001 From: addisonlynch Date: Tue, 11 Dec 2018 16:08:00 -0500 Subject: [PATCH 1/2] Added ignore timer flag --- dotfiles.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dotfiles.sh b/dotfiles.sh index 5f0c5e5..44312ae 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -22,6 +22,7 @@ VERSION='0.4' DOTFILES_DIR="${PWD}" TARGET=~ CHECK_WGET_TYPE_AND_ENCODING='no' +IGNORE_TIMER='no' ##### # External utilities @@ -783,7 +784,7 @@ function update() # touching this file. UPDATE_FILE="${REPO}/updated.$(date +%U)" - if [ ! -e "${UPDATE_FILE}" ]; then + if [ ! -e "${UPDATE_FILE}" ] || [ "${IGNORE_TIMER}" = 'yes' ]; then echo "update ${REPO} dotfiles" "${RM}" -f "${REPO}"/updated.* || return 1 "${TOUCH}" "${UPDATE_FILE}" || return 1 @@ -840,6 +841,9 @@ function main() echo "${VERSION}" return ;; + '--ignore-timer') + IGNORE_TIMER='yes' + ;; '--dotfiles-dir') DOTFILES_DIR="${2}" shift From 1bf9e10824c43fa3c77338743acac9835f29e78a Mon Sep 17 00:00:00 2001 From: addisonlynch Date: Tue, 11 Dec 2018 16:22:31 -0500 Subject: [PATCH 2/2] Add README entry --- README | 3 ++- dotfiles.sh | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README b/README index 88e35c5..1f1f1c8 100644 --- a/README +++ b/README @@ -44,7 +44,8 @@ order to automate this, you may want to add this line to your Bash shell. Since dotfiles are not expected to change rapidly, the ``update`` command remembers the last time it ran and only actually performs the update if it has been at least a week since the last -update. +update. To ignore this weekly timer, pass the ``--ignore-timer`` flag to +``update``. If you're using Git, you may have a choice of transport protocols for accessing the central repository. Some protocols (e.g. SSH) often diff --git a/dotfiles.sh b/dotfiles.sh index 44312ae..fd225d5 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -773,7 +773,13 @@ function update() { LINK_OPTS='' while [ "${1::2}" = '--' ]; do - LINK_OPTS="${LINK_FN_OPTS} ${1}" + case "${1}" in + '--ignore-timer') + IGNORE_TIMER='yes' + ;; + *) + LINK_OPTS="${LINK_FN_OPTS} ${1}" + esac shift done # multi-repo case handled in main() by run_on_all_repos() @@ -841,9 +847,6 @@ function main() echo "${VERSION}" return ;; - '--ignore-timer') - IGNORE_TIMER='yes' - ;; '--dotfiles-dir') DOTFILES_DIR="${2}" shift