[tools] initial commit

This commit is contained in:
Matt Hamilton 2016-05-14 15:22:04 -07:00
parent fc45c8e328
commit b7bc7bb69e
6 changed files with 52 additions and 0 deletions

5
tools/zim_build_cache Normal file
View File

@ -0,0 +1,5 @@
#
# zim_build_cache - rebuilds the zim cache
#
source ${ZDOTDIR:-${HOME}}/templates/zlogin

8
tools/zim_clean_cache Normal file
View File

@ -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'

9
tools/zim_info Normal file
View File

@ -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)"

13
tools/zim_remove Normal file
View File

@ -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/

6
tools/zim_reset Normal file
View File

@ -0,0 +1,6 @@
#
# zim_reset - resets the zim repository to latest commit
#
cd ${ZDOTDIR:-${HOME}}/.zim
git reset --hard

11
tools/zim_update Normal file
View File

@ -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