mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #18422 from Homebrew/cmd-cache-touchup
cmd/--cache: avoid exception on missing HEAD
This commit is contained in:
commit
05cde76adc
@ -17,7 +17,7 @@ module Homebrew
|
||||
description <<~EOS
|
||||
Display Homebrew's download cache. See also `HOMEBREW_CACHE`.
|
||||
|
||||
If <formula> is provided, display the file or directory used to cache <formula>.
|
||||
If a <formula> or <cask> is provided, display the file or directory used to cache it.
|
||||
EOS
|
||||
flag "--os=",
|
||||
description: "Show cache file for the given operating system. " \
|
||||
@ -113,7 +113,11 @@ module Homebrew
|
||||
|
||||
puts bottle.cached_download
|
||||
elsif args.HEAD?
|
||||
puts T.must(formula.head).cached_download
|
||||
if (head = formula.head)
|
||||
puts head.cached_download
|
||||
else
|
||||
opoo "No head is defined for #{formula.full_name}."
|
||||
end
|
||||
else
|
||||
puts formula.cached_download
|
||||
end
|
||||
|
@ -1494,8 +1494,8 @@ dependency for their stable builds.
|
||||
|
||||
Display Homebrew's download cache. See also `HOMEBREW_CACHE`.
|
||||
|
||||
If *`formula`* is provided, display the file or directory used to cache
|
||||
*`formula`*.
|
||||
If a *`formula`* or *`cask`* is provided, display the file or directory used to
|
||||
cache it.
|
||||
|
||||
`--os`
|
||||
|
||||
|
@ -938,7 +938,7 @@ Include only casks\.
|
||||
.SS "\fB\-\-cache\fP \fR[\fIoptions\fP] \fR[\fIformula\fP|\fIcask\fP \.\.\.]"
|
||||
Display Homebrew\[u2019]s download cache\. See also \fBHOMEBREW_CACHE\fP\&\.
|
||||
.P
|
||||
If \fIformula\fP is provided, display the file or directory used to cache \fIformula\fP\&\.
|
||||
If a \fIformula\fP or \fIcask\fP is provided, display the file or directory used to cache it\.
|
||||
.TP
|
||||
\fB\-\-os\fP
|
||||
Show cache file for the given operating system\. (Pass \fBall\fP to show cache files for all operating systems\.)
|
||||
|
Loading…
x
Reference in New Issue
Block a user