From b7bc7bb69ec0df7cfe9442e4d22ab9620c6e6351 Mon Sep 17 00:00:00 2001 From: Matt Hamilton Date: Sat, 14 May 2016 15:22:04 -0700 Subject: [PATCH] [tools] initial commit --- tools/zim_build_cache | 5 +++++ tools/zim_clean_cache | 8 ++++++++ tools/zim_info | 9 +++++++++ tools/zim_remove | 13 +++++++++++++ tools/zim_reset | 6 ++++++ tools/zim_update | 11 +++++++++++ 6 files changed, 52 insertions(+) create mode 100644 tools/zim_build_cache create mode 100644 tools/zim_clean_cache create mode 100644 tools/zim_info create mode 100644 tools/zim_remove create mode 100644 tools/zim_reset create mode 100644 tools/zim_update diff --git a/tools/zim_build_cache b/tools/zim_build_cache new file mode 100644 index 0000000..9b5900e --- /dev/null +++ b/tools/zim_build_cache @@ -0,0 +1,5 @@ +# +# zim_build_cache - rebuilds the zim cache +# + +source ${ZDOTDIR:-${HOME}}/templates/zlogin diff --git a/tools/zim_clean_cache b/tools/zim_clean_cache new file mode 100644 index 0000000..cc62215 --- /dev/null +++ b/tools/zim_clean_cache @@ -0,0 +1,8 @@ +# +# zim_clean_cache - removes all zcompiled files +# + +find ${ZDOTDIR:-${HOME}}/.zim/ -iname '*.zwc' | xargs rm +rm -f ${ZDOTDIR:-${HOME}}/.{zshrc.zwc,zcompdump,zcompdump.zwc} + +print 'To rebuild the completion cache, please restart your terminal' diff --git a/tools/zim_info b/tools/zim_info new file mode 100644 index 0000000..f5c8b36 --- /dev/null +++ b/tools/zim_info @@ -0,0 +1,9 @@ +# +# zim_info - prints zim and system info +# + +cd ${ZDOTDIR:-${HOME}}/.zim + +print "Zim commit ref: $(command git rev-parse --short HEAD)" +print "Zsh version: $(command zsh --version)" +print "System info: $(command uname -mosr)" diff --git a/tools/zim_remove b/tools/zim_remove new file mode 100644 index 0000000..925f9b5 --- /dev/null +++ b/tools/zim_remove @@ -0,0 +1,13 @@ +# +# zim_remove - removes zim from the system +# +# Note: this doesn't remove _everything_. It removes as much as +# possible while maintaining safety (don't delete custom user content). +# + +sed '/# Source zim/,/fi/d' ${ZDOTDIR:-${HOME}}/.zshrc +sed '/# The following code helps/,/) &!/d' ${ZDOTDIR:-${HOME}}/.zlogin +rm -f ${ZDOTDIR:-${HOME}}/.zimrc + +# not forcing this one, as it is recursive. It's possible something went wrong. +rm -r ${ZDOTDIR:-${HOME}}/.zim/ diff --git a/tools/zim_reset b/tools/zim_reset new file mode 100644 index 0000000..2357fc0 --- /dev/null +++ b/tools/zim_reset @@ -0,0 +1,6 @@ +# +# zim_reset - resets the zim repository to latest commit +# + +cd ${ZDOTDIR:-${HOME}}/.zim +git reset --hard diff --git a/tools/zim_update b/tools/zim_update new file mode 100644 index 0000000..1d7ee05 --- /dev/null +++ b/tools/zim_update @@ -0,0 +1,11 @@ +# +# zim_update - update the zim repository +# + +cd ${ZIM} + +# this is the cleanest way I know of to update a repository +git remote update -p +git merge --ff-only @\{u\} +# and update the submodules +git submodule update --init --recursive