From f7d3cdf812d63e8b34780c4899d80e3d9464620f Mon Sep 17 00:00:00 2001 From: Matt Hamilton Date: Fri, 2 Sep 2016 18:28:29 -0700 Subject: [PATCH] [meta] add module and fixup tools --- modules/meta/README.md | 18 ++++++++++++++++++ modules/meta/functions/zmanage | 34 ++++++++++++++++++++++++++++++++++ tools/zim_build_cache | 2 +- tools/zim_update | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 modules/meta/README.md create mode 100644 modules/meta/functions/zmanage diff --git a/modules/meta/README.md b/modules/meta/README.md new file mode 100644 index 0000000..a50eb82 --- /dev/null +++ b/modules/meta/README.md @@ -0,0 +1,18 @@ +Meta +==== + +Provides aliases and functions for management of the zim framework, specifically `zmanage` + +Usage +----- + +`zmanage [arg]` + +| Action | Description | +| ----------- | --------------------------------------------------- | +| update | Fetches and merges upstream zim commits if possible | +| info | Prints zim and system info | +| clean-cache | Clean the zim cache | +| build-cache | Rebuild the zim cache | +| remove | *experimental* Remove zim as best we can | +| reset | Reset zim to the latest commit | diff --git a/modules/meta/functions/zmanage b/modules/meta/functions/zmanage new file mode 100644 index 0000000..0a13f77 --- /dev/null +++ b/modules/meta/functions/zmanage @@ -0,0 +1,34 @@ +usage="${0} [action] +Actions: + | update | Fetches and merges upstream zim commits if possible | + | info | Prints zim and system info | + | clean-cache | Clean the zim cache | + | build-cache | Rebuild the zim cache | + | remove | *experimental* Remove zim as best we can | + | reset | Reset zim to the latest commit | + | help | Print this usage message |" + +if (( ${#} != 1 )); then + print ${usage} + return 1 +fi + +local tools +tools="${ZIM}/tools" + +case ${1} in + update) zsh ${tools}/zim_update + ;; + info) zsh ${tools}/zim_info + ;; + clean-cache) zsh ${tools}/zim_clean_cache && print 'Cleaned cache' + ;; + build-cache) source ${tools}/zim_build_cache && print 'Rebuilt cache' + ;; + remove) zsh ${tools}/zim_remove + ;; + reset) zsh ${tools}/zim_reset + ;; + *) print ${usage} + ;; +esac diff --git a/tools/zim_build_cache b/tools/zim_build_cache index 9b5900e..3e747e4 100644 --- a/tools/zim_build_cache +++ b/tools/zim_build_cache @@ -2,4 +2,4 @@ # zim_build_cache - rebuilds the zim cache # -source ${ZDOTDIR:-${HOME}}/templates/zlogin +source ${ZDOTDIR:-${HOME}}/.zim/templates/zlogin diff --git a/tools/zim_update b/tools/zim_update index 1d7ee05..2568725 100644 --- a/tools/zim_update +++ b/tools/zim_update @@ -2,7 +2,7 @@ # zim_update - update the zim repository # -cd ${ZIM} +cd ${ZDOTDIR:-${HOME}/.zim} # this is the cleanest way I know of to update a repository git remote update -p