1
0
Fork 0
mirror of synced 2024-06-01 14:51:11 -04:00
zimfw/src/stage2/70_zimfw_run_tool.zsh.erb
Eric Nielsen 5bcfb8cc9f
Override repository options along zmodule calls
for the same module name. Other minor fixes:
* Show skipping already installed modules with install action and `-v`.
* Consider external module dirs when calling compile action directly, by
  making sure _zimfw_source_zimrc is called first.
* Ignore return value from `zargs` with `-P`, as it's oddly returning
  123 since Zsh 5.9. Maybe related to these changes:
  67f932e7c5
2022-05-17 18:43:59 -05:00

41 lines
1.6 KiB
Plaintext

_zimfw_run_tool() {
local -r zname=${1}
if [[ -z ${_zurls[${zname}]} ]]; then
if (( _zprintlevel > 1 )) print -u2 -PR <%= clear_line %>"<%= okay %>%B${zname}:%b Skipping external module"
return 0
fi
if (( _zfrozens[${zname}] )); then
if (( _zprintlevel > 1 )) print -u2 -PR <%= clear_line %>"<%= okay %>%B${zname}:%b Skipping frozen module"
return 0
fi
case ${_zargs_action} in
install)
if [[ -e ${_zdirs[${zname}]} ]]; then
if (( _zprintlevel > 1 )) print -u2 -PR <%= clear_line %>"<%= okay %>%B${zname}:%b Skipping already installed module"
return 0
fi
_zimfw_print -nR <%= clear_line %>"Installing ${zname}<%= ellipsis %>"
;;
update)
if [[ ! -d ${_zdirs[${zname}]} ]]; then
print -u2 -PR <%= clear_line %>"%F{red}<%= error %>%B${zname}:%b Not installed. Run %Bzimfw install%b to install.%f"
return 1
fi
_zimfw_print -nR <%= clear_line %>"Updating ${zname}<%= ellipsis %>"
;;
*)
print -u2 -PR <%= clear_line %>"%F{red}<%= error %>%B${zname}:%b Unknown action ${_zargs_action}%f"
return 1
;;
esac
local zcmd
case ${_ztools[${zname}]} in
<%= render_tools("src/tools/*", "zcmd") %>
*)
print -u2 -PR "<%= clear_line %>%F{red}<%= error %>%B${zname}:%b Unknown tool ${_ztools[${zname}]}%f"
return 1
;;
esac
zsh -c ${zcmd} ${_ztools[${zname}]} "${_zprintlevel}" "${_zargs_action}" "${zname}" "${_zdirs[${zname}]}" "${_zurls[${zname}]}" "${_ztypes[${zname}]}" "${_zrevs[${zname}]}" "${_zsubmodules[${zname}]}" "${_zonpulls[${zname}]}"
}