Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list.sh: simplify #18219

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions Library/Homebrew/list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ homebrew-list() {
tty=1
fi

local error_string="LS_ERRORED"
if [[ -z "${cask}" && -d "${HOMEBREW_CELLAR}" ]]
then
if [[ -n "${tty}" && -z "${formula}" ]]
Expand All @@ -40,11 +39,8 @@ homebrew-list() {
fi

local formula_output
formula_output="$(ls "${ls_args[@]}" "${HOMEBREW_CELLAR}" || echo "${error_string}")"
if [[ "${formula_output}" == "${error_string}" ]]
then
exit 1
elif [[ -n "${formula_output}" ]]
formula_output="$(ls "${ls_args[@]}" "${HOMEBREW_CELLAR}")" || exit 1
if [[ -n "${formula_output}" ]]
then
echo "${formula_output}"
fi
Expand All @@ -63,11 +59,8 @@ homebrew-list() {
fi

local cask_output
cask_output="$(ls "${ls_args[@]}" "${HOMEBREW_CASKROOM}" || echo "${error_string}")"
if [[ "${cask_output}" == "${error_string}" ]]
then
exit 1
elif [[ -n "${cask_output}" ]]
cask_output="$(ls "${ls_args[@]}" "${HOMEBREW_CASKROOM}")" || exit 1
if [[ -n "${cask_output}" ]]
then
echo "${cask_output}"
fi
Expand Down