mirror of https://github.com/zimfw/zimfw.git
Prompt before uninstalling modules, so users have a chance to review the list before moving forward with the action.pull/437/head
parent
ef4fe38716
commit
78b4711750
@ -1,12 +1,15 @@ |
||||
_zimfw_uninstall() { |
||||
local zopt zdir zmodule |
||||
local zopt |
||||
if (( _zprintlevel > 0 )) zopt='-v' |
||||
for zdir in ${ZIM_HOME}/modules/*(N/); do |
||||
zmodule=${zdir:t} |
||||
# If _zmodules and _zdisableds do not contain the zmodule |
||||
if (( ! ${_zmodules[(I)${zmodule}]} && ! ${_zdisableds[(I)${zmodule}]} )); then |
||||
command rm -rf ${zopt} ${zdir} || return 1 |
||||
local zuninstalls=(${ZIM_HOME}/modules/*(N/:t)) |
||||
# Uninstall all installed modules not in _zmodules and _zdisableds |
||||
zuninstalls=(${${zuninstalls:|_zmodules}:|_zdisableds}) |
||||
if (( ${#zuninstalls} )); then |
||||
_zimfw_print -PR %B${(F)zuninstalls}%b |
||||
if (( _zprintlevel <= 0 )) || read -q "?Uninstall ${#zuninstalls} module(s) listed above [y/N]? "; then |
||||
_zimfw_print |
||||
command rm -rf ${zopt} ${ZIM_HOME}/modules/${^zuninstalls} || return 1 |
||||
fi |
||||
done |
||||
fi |
||||
_zimfw_print -P '<%= done %>Done with uninstall.' |
||||
} |
||||
|
Loading…
Reference in new issue