From d4dfe390378c889ad0c78cf10074e2607ed1bc52 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 26 Apr 2012 02:41:13 +0100 Subject: [PATCH] Improve how return value of certain commands are checked --- bin/tmuxifier | 5 ++--- libexec/tmuxifier-completions | 5 ++--- libexec/tmuxifier-help | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bin/tmuxifier b/bin/tmuxifier index 9ab31e5..281182a 100755 --- a/bin/tmuxifier +++ b/bin/tmuxifier @@ -24,10 +24,9 @@ case "$command" in ;; * ) + # Lookup command, attempt to resolve as alias if fails ! command_path="$(command -v "tmuxifier-$command")" - - # Attempt to resolve aliases - if [ -z "$command_path" ]; then + if [ ! -n $? ]; then resolved="$(tmuxifier-alias "$command")" if [ ! -z "$resolved" ]; then ! command_path="$(command -v "tmuxifier-$resolved")" diff --git a/libexec/tmuxifier-completions b/libexec/tmuxifier-completions index 5281b50..e42b981 100755 --- a/libexec/tmuxifier-completions +++ b/libexec/tmuxifier-completions @@ -18,10 +18,9 @@ if [ -z "$command" ]; then exit 1 fi +# Lookup command, attempt to resolve as alias if fails ! command_path="$(command -v "tmuxifier-$command")" - -# Attempt to resolve aliases -if [ -z "$command_path" ]; then +if [ ! -n $? ]; then resolved="$(tmuxifier-alias "$command")" if [ ! -z "$resolved" ]; then ! command_path="$(command -v "tmuxifier-$resolved")" diff --git a/libexec/tmuxifier-help b/libexec/tmuxifier-help index e0b9051..34e6042 100755 --- a/libexec/tmuxifier-help +++ b/libexec/tmuxifier-help @@ -9,10 +9,10 @@ if [ "$1" == "--complete" ]; then fi command="$1" -! command_path="$(command -v "tmuxifier-$command")" -# Attempt to resolve aliases -if [ -z "$command_path" ]; then +# Lookup command, attempt to resolve as alias if fails +! command_path="$(command -v "tmuxifier-$command")" +if [ ! -n $? ]; then resolved="$(tmuxifier-alias "$command")" if [ ! -z "$resolved" ]; then command="$resolved"