From a63b053e5839614e70b5c92d8763f2e78deacd55 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 10 Apr 2012 23:16:04 -0400 Subject: [PATCH] [#125] Add a helper that checks callables --- helper.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/helper.zsh b/helper.zsh index 89f830ec..ad06e694 100644 --- a/helper.zsh +++ b/helper.zsh @@ -11,6 +11,11 @@ function is-true { [[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]] } +# Checks a name if it is a command, function, or alias. +function is-callable { + (( $+commands[$1] )) || (( $+functions[$1] )) || (( $+aliases[$1] )) +} + # Prints the first non-empty string in the arguments array. function coalesce { for arg in $argv; do