[meta] Move zmanage to function in init.zsh
and delete the meta module altogether. Also refactor `tools/zim_issue` to use `tools/zim_info`, use local variables, and print the output directly without the need of the intermediate `issue_md` array. Closes #218
This commit is contained in:
parent
a8244a555a
commit
e0a7c679e0
5 changed files with 55 additions and 91 deletions
40
init.zsh
40
init.zsh
|
@ -39,3 +39,43 @@ fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zmanage() {
|
||||||
|
local usage="zmanage [action]
|
||||||
|
Actions:
|
||||||
|
update Fetch and merge upstream zim commits if possible
|
||||||
|
info Print zim and system info
|
||||||
|
issue Create a template for reporting an issue
|
||||||
|
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
|
||||||
|
debug Invoke the trace-zim script which produces logs
|
||||||
|
help Print this usage message"
|
||||||
|
|
||||||
|
if (( ${#} != 1 )); then
|
||||||
|
print ${usage}
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case ${1} in
|
||||||
|
update) zsh ${ZIM_HOME}/tools/zim_update
|
||||||
|
;;
|
||||||
|
info) zsh ${ZIM_HOME}/tools/zim_info
|
||||||
|
;;
|
||||||
|
issue) zsh ${ZIM_HOME}/tools/zim_issue
|
||||||
|
;;
|
||||||
|
clean-cache) source ${ZIM_HOME}/tools/zim_clean_cache && print 'Cache cleaned'
|
||||||
|
;;
|
||||||
|
build-cache) source ${ZIM_HOME}/tools/zim_build_cache && print 'Cache rebuilt'
|
||||||
|
;;
|
||||||
|
remove) zsh ${ZIM_HOME}/tools/zim_remove
|
||||||
|
;;
|
||||||
|
reset) zsh ${ZIM_HOME}/tools/zim_reset
|
||||||
|
;;
|
||||||
|
debug) zsh ${ZIM_HOME}/modules/debug/functions/trace-zim
|
||||||
|
;;
|
||||||
|
*) print ${usage}; return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
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 |
|
|
||||||
| issue | Create a template for reporting an issue |
|
|
||||||
| 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 |
|
|
||||||
| debug | Invokes the trace-zim script which produces logs |
|
|
|
@ -1,40 +0,0 @@
|
||||||
local usage="${0} [action]
|
|
||||||
Actions:
|
|
||||||
| update | Fetches and merges upstream zim commits if possible |
|
|
||||||
| info | Prints zim and system info |
|
|
||||||
| issue | Create a template for reporting an issue |
|
|
||||||
| 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 |
|
|
||||||
| debug | Invokes the trace-zim script which produces logs |"
|
|
||||||
|
|
||||||
if (( ${#} != 1 )); then
|
|
||||||
print ${usage}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local tools
|
|
||||||
tools="${ZIM_HOME}/tools"
|
|
||||||
|
|
||||||
case ${1} in
|
|
||||||
update) zsh ${tools}/zim_update
|
|
||||||
;;
|
|
||||||
info) zsh ${tools}/zim_info
|
|
||||||
;;
|
|
||||||
issue) zsh ${tools}/zim_issue
|
|
||||||
;;
|
|
||||||
clean-cache) source ${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
|
|
||||||
;;
|
|
||||||
debug) zsh ${ZIM_HOME}/modules/debug/functions/trace-zim
|
|
||||||
;;
|
|
||||||
*) print ${usage}
|
|
||||||
;;
|
|
||||||
esac
|
|
|
@ -11,7 +11,7 @@
|
||||||
# Select what modules you would like enabled.
|
# Select what modules you would like enabled.
|
||||||
# The second line of modules may depend on options set by modules in the first
|
# The second line of modules may depend on options set by modules in the first
|
||||||
# line. These dependencies are noted on the respective module's README.md.
|
# line. These dependencies are noted on the respective module's README.md.
|
||||||
zmodules=(directory environment git git-info history input utility meta custom \
|
zmodules=(directory environment git git-info history input utility custom \
|
||||||
syntax-highlighting history-substring-search prompt completion)
|
syntax-highlighting history-substring-search prompt completion)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,41 +27,26 @@ fi
|
||||||
cd ${ZIM_HOME}
|
cd ${ZIM_HOME}
|
||||||
|
|
||||||
# collect sys info
|
# collect sys info
|
||||||
git_dirty=$(command git status --porcelain 2>/dev/null | tail -n1)
|
local git_dirty=$(command git status --porcelain 2>/dev/null | tail -n1)
|
||||||
git_ref=$(command git rev-parse --short HEAD)
|
local zim_info=$(zsh tools/zim_info)
|
||||||
zsh_version=$(zsh --version)
|
|
||||||
operating_sys=$(uname -a)
|
|
||||||
|
|
||||||
|
print "Environment Info
|
||||||
|
----------------
|
||||||
|
${zim_info}
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
${user_desc}
|
||||||
|
|
||||||
# we're going to template and build the issue here (as an array for convenience)
|
Steps to Reproduce
|
||||||
|
------------------
|
||||||
|
${user_reproduce}
|
||||||
|
|
||||||
issue_md=("Environment Info"
|
Images or other Information
|
||||||
"----------------"
|
---------------------------
|
||||||
"- Zim commit ref: ${git_ref}"
|
"
|
||||||
"- Zsh version: ${zsh_version}"
|
|
||||||
"- Operating System Info: ${operating_sys}"
|
|
||||||
""
|
|
||||||
"Description"
|
|
||||||
"-----------"
|
|
||||||
"${user_desc}"
|
|
||||||
""
|
|
||||||
"Steps to Reproduce"
|
|
||||||
"------------------"
|
|
||||||
"${user_reproduce}"
|
|
||||||
""
|
|
||||||
"Images or other Information"
|
|
||||||
"---------------------------"
|
|
||||||
""
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# print the output:
|
|
||||||
# hack: we need to iterate over the elements to capture the blank spaces (to print newlines)
|
|
||||||
for (( i=0; i < ${#issue_md[@]}; i++ )); do
|
|
||||||
printf '%s\n' ${issue_md[i]}
|
|
||||||
done
|
|
||||||
|
|
||||||
# if we have a dirty git, report it
|
# if we have a dirty git, report it
|
||||||
if [[ -n ${git_dirty} ]]; then
|
if [[ -n ${git_dirty} ]]; then
|
||||||
print "${ZIM_HOME} has a dirty git working tree."
|
print "${ZIM_HOME} has a dirty git working tree."
|
||||||
|
|
Loading…
Reference in a new issue