From 2098e5cf5f0c63e481f1c715d9e9679dc5912d52 Mon Sep 17 00:00:00 2001 From: Lucas Larson Date: Mon, 28 Feb 2022 17:47:33 -0500 Subject: [PATCH] add additional function definition this commit is the first to assertively permit unambiguous non-POSIX content Signed-off-by: Lucas Larson --- custom/aliases.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/custom/aliases.zsh b/custom/aliases.zsh index f88b6c48f4..8498db019e 100644 --- a/custom/aliases.zsh +++ b/custom/aliases.zsh @@ -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 }