mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
list.sh: simplify
We don't need to output an intermediate `LS_ERRORED` string to exit in case that `ls` errors out.
This commit is contained in:
parent
21443e60e4
commit
eca9a0d201
@ -31,7 +31,6 @@ homebrew-list() {
|
|||||||
tty=1
|
tty=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local error_string="LS_ERRORED"
|
|
||||||
if [[ -z "${cask}" && -d "${HOMEBREW_CELLAR}" ]]
|
if [[ -z "${cask}" && -d "${HOMEBREW_CELLAR}" ]]
|
||||||
then
|
then
|
||||||
if [[ -n "${tty}" && -z "${formula}" ]]
|
if [[ -n "${tty}" && -z "${formula}" ]]
|
||||||
@ -40,11 +39,8 @@ homebrew-list() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local formula_output
|
local formula_output
|
||||||
formula_output="$(ls "${ls_args[@]}" "${HOMEBREW_CELLAR}" || echo "${error_string}")"
|
formula_output="$(ls "${ls_args[@]}" "${HOMEBREW_CELLAR}")" || exit 1
|
||||||
if [[ "${formula_output}" == "${error_string}" ]]
|
if [[ -n "${formula_output}" ]]
|
||||||
then
|
|
||||||
exit 1
|
|
||||||
elif [[ -n "${formula_output}" ]]
|
|
||||||
then
|
then
|
||||||
echo "${formula_output}"
|
echo "${formula_output}"
|
||||||
fi
|
fi
|
||||||
@ -63,11 +59,8 @@ homebrew-list() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local cask_output
|
local cask_output
|
||||||
cask_output="$(ls "${ls_args[@]}" "${HOMEBREW_CASKROOM}" || echo "${error_string}")"
|
cask_output="$(ls "${ls_args[@]}" "${HOMEBREW_CASKROOM}")" || exit 1
|
||||||
if [[ "${cask_output}" == "${error_string}" ]]
|
if [[ -n "${cask_output}" ]]
|
||||||
then
|
|
||||||
exit 1
|
|
||||||
elif [[ -n "${cask_output}" ]]
|
|
||||||
then
|
then
|
||||||
echo "${cask_output}"
|
echo "${cask_output}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user