Merge pull request #4116 from commitay/zap-force

Fix `zap --force` for uninstalled casks
This commit is contained in:
commitay 2018-05-11 08:42:03 +10:00 committed by GitHub
commit 2b6f477143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 7 deletions

View File

@ -58,7 +58,7 @@ module Hbc
end
unless target.exist?
return if skip
return if skip || force
raise CaskError, "It seems the #{self.class.english_name} source '#{target}' is not there."
end

View File

@ -11,6 +11,9 @@ module Hbc
def run
casks.each do |cask|
odebug "Zapping Cask #{cask}"
raise CaskNotInstalledError, cask unless cask.installed? || force?
Installer.new(cask, verbose: verbose?, force: force?).zap
end
end

View File

@ -123,11 +123,11 @@ names, and other aspects of this manual are still subject to change.
If `--greedy` is given then also upgrade the Casks having `auto_updates true`
or `version :latest`.
* `zap` <token> [ <token> ... ]:
* `zap` [--force] <token> [ <token> ... ]:
Unconditionally remove _all_ files associated with the given Cask.
With `--force`, zap even if the Cask does not appear to be currently installed.
Implicitly performs all actions associated with `uninstall`, even if
the Cask does not appear to be currently installed.
Implicitly performs all actions associated with `uninstall`.
Removes all staged versions of the Cask distribution found under
`<Caskroom_path>/`<token>.

View File

@ -118,11 +118,11 @@ Uninstall the given Cask\. With \fB\-\-force\fR, uninstall even if the Cask does
Without token arguments, upgrade all the installed Casks that have newer versions available in the tap; otherwise update the tokens given in the command line\. If \fB\-\-greedy\fR is given then also upgrade the Casks having \fBauto_updates true\fR or \fBversion :latest\fR\.
.
.TP
\fBzap\fR \fItoken\fR [ \fItoken\fR \.\.\. ]
Unconditionally remove \fIall\fR files associated with the given Cask\.
\fBzap\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ]
Unconditionally remove \fIall\fR files associated with the given Cask\. With \fB\-\-force\fR, zap even if the Cask does not appear to be currently installed\.
.
.IP
Implicitly performs all actions associated with \fBuninstall\fR, even if the Cask does not appear to be currently installed\.
Implicitly performs all actions associated with \fBuninstall\fR\.
.
.IP
Removes all staged versions of the Cask distribution found under \fB<Caskroom_path>/\fR\fItoken\fR\.