Skip to content

Commit

Permalink
add additional function definition
Browse files Browse the repository at this point in the history
this commit is the first to assertively permit unambiguous non-POSIX content

Signed-off-by: Lucas Larson <[email protected]>
  • Loading branch information
LucasLarson committed Feb 28, 2022
1 parent a25f52b commit 2098e5c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions custom/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,20 @@ define() {
command -v which >/dev/null 2>&1 &&
printf 'which -a:\n%s\n' "$(command which -a "${query-}")"

{
if functions "${query-}" 2>/dev/null | command bash --pretty-print >/dev/null 2>&1 | command shfmt -s -i 2 >/dev/null 2>&1; then
printf '%s\n' "$(builtin functions "${query-}" | command bash --pretty-print | command shfmt -s -i 2)"
elif builtin functions "${query-}" 2>/dev/null | command shfmt -s -i 2 >/dev/null 2>&1; then
printf '%s\n' "$(builtin functions "${query-}" | command shfmt -s -i 2)"
elif builtin functions "${query-}" 2>/dev/null | command bash --pretty-print >/dev/null 2>&1; then
printf '%s\n' "$(builtin functions "${query-}" | command bash --pretty-print)"
elif builtin functions "${query-}" >/dev/null 2>&1; then
printf '%s\n' "$(builtin functions "${query-}")"
else
"$(command -v type)" -a -f -- "${query-}" 2>/dev/null
fi
} |
command sed -e 's|\t| |g'
done
unset -- query 2>/dev/null
}
Expand Down

0 comments on commit 2098e5c

Please sign in to comment.