From b48e0ed74fff1984f230d288a2342d7b97db1bf0 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 8 Sep 2012 19:21:00 -0400 Subject: [PATCH] [Fix #249] Add documentation for helper --- modules/helper/README.md | 12 ++++++++---- modules/helper/init.zsh | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/helper/README.md b/modules/helper/README.md index ae0ea95..b010b00 100644 --- a/modules/helper/README.md +++ b/modules/helper/README.md @@ -1,14 +1,18 @@ -Trap -==== +Helper +====== -Provides for trapping UNIX signals and calling callback functions when a trap -is triggered. +Provides helper functions for developing modules. Functions --------- - `add-zsh-trap` adds a function name to a list to be called when a trap is triggered. + - `is-autoloadable` checks if a file can be autoloaded by trying to load it + in a subshell. + - `is-callable` checks if a name is a command, function, or alias. + - `is-true` checks a boolean variable for "true". + - `coalesce` prints the first non-empty string in the arguments array. Authors ------- diff --git a/modules/helper/init.zsh b/modules/helper/init.zsh index 72e4855..7e0f9d5 100644 --- a/modules/helper/init.zsh +++ b/modules/helper/init.zsh @@ -10,7 +10,7 @@ function is-autoloadable { ( unfunction $1 ; autoload -U +X $1 ) &> /dev/null } -# Checks a name if it is a command, function, or alias. +# Checks if a name is a command, function, or alias. function is-callable { (( $+commands[$1] )) || (( $+functions[$1] )) || (( $+aliases[$1] )) }