Prompt before zimfw uninstall, unless -q
is set
Prompt before uninstalling modules, so users have a chance to review the list before moving forward with the action.
This commit is contained in:
parent
ef4fe38716
commit
78b4711750
3 changed files with 23 additions and 16 deletions
|
@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
_No unreleased changes._
|
||||
### Fixed
|
||||
- Prompt before uninstalling modules, unless `-q` is set.
|
||||
|
||||
## [1.3.2] - 2020-08-01
|
||||
|
||||
|
|
|
@ -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
|
||||
fi
|
||||
done
|
||||
_zimfw_print -P '<%= done %>Done with uninstall.'
|
||||
}
|
||||
|
|
19
zimfw.zsh
19
zimfw.zsh
|
@ -315,22 +315,25 @@ _zimfw_compile() {
|
|||
}
|
||||
|
||||
_zimfw_info() {
|
||||
print -R 'zimfw version: '${_zversion}' (previous commit is fbf0fe0)'
|
||||
print -R 'zimfw version: '${_zversion}' (previous commit is ef4fe38)'
|
||||
print -R 'ZIM_HOME: '${ZIM_HOME}
|
||||
print -R 'Zsh version: '${ZSH_VERSION}
|
||||
print -R 'System info: '$(command uname -a)
|
||||
}
|
||||
|
||||
_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
|
||||
fi
|
||||
done
|
||||
_zimfw_print -P 'Done with uninstall.'
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue