From 855c522cf054e8047853837d321a655f33cd8708 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 26 Apr 2012 02:22:40 +0100 Subject: [PATCH] Avoid exiting with a cleaner syntax for commands that might fail --- bin/tmuxifier | 4 ++-- lib/layout-helpers.sh | 2 +- libexec/tmuxifier-completions | 4 ++-- libexec/tmuxifier-help | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/tmuxifier b/bin/tmuxifier index 624e0f9..9ab31e5 100755 --- a/bin/tmuxifier +++ b/bin/tmuxifier @@ -24,13 +24,13 @@ case "$command" in ;; * ) - command_path="$(command -v "tmuxifier-$command" || true)" + ! command_path="$(command -v "tmuxifier-$command")" # Attempt to resolve aliases if [ -z "$command_path" ]; then resolved="$(tmuxifier-alias "$command")" if [ ! -z "$resolved" ]; then - command_path="$(command -v "tmuxifier-$resolved" || true)" + ! command_path="$(command -v "tmuxifier-$resolved")" fi fi diff --git a/lib/layout-helpers.sh b/lib/layout-helpers.sh index 0293396..b293f3b 100644 --- a/lib/layout-helpers.sh +++ b/lib/layout-helpers.sh @@ -157,7 +157,7 @@ initialize_session() { # created, the session already exists, and we'll need to specifically switch # to it here. finalize_and_go_to_session() { - tmux kill-window -t "$session:99" 2>/dev/null || true + ! tmux kill-window -t "$session:99" 2>/dev/null if [[ "$(tmuxifier-current-session)" != "$session" ]]; then __go_to_session fi diff --git a/libexec/tmuxifier-completions b/libexec/tmuxifier-completions index 3da0423..5281b50 100755 --- a/libexec/tmuxifier-completions +++ b/libexec/tmuxifier-completions @@ -18,13 +18,13 @@ if [ -z "$command" ]; then exit 1 fi -command_path="$(command -v "tmuxifier-$command" || true)" +! command_path="$(command -v "tmuxifier-$command")" # Attempt to resolve aliases if [ -z "$command_path" ]; then resolved="$(tmuxifier-alias "$command")" if [ ! -z "$resolved" ]; then - command_path="$(command -v "tmuxifier-$resolved" || true)" + ! command_path="$(command -v "tmuxifier-$resolved")" fi fi diff --git a/libexec/tmuxifier-help b/libexec/tmuxifier-help index b53f269..e0b9051 100755 --- a/libexec/tmuxifier-help +++ b/libexec/tmuxifier-help @@ -9,14 +9,14 @@ if [ "$1" == "--complete" ]; then fi command="$1" -command_path="$(command -v "tmuxifier-$command" || true)" +! command_path="$(command -v "tmuxifier-$command")" # Attempt to resolve aliases if [ -z "$command_path" ]; then resolved="$(tmuxifier-alias "$command")" if [ ! -z "$resolved" ]; then command="$resolved" - command_path="$(command -v "tmuxifier-$command" || true)" + ! command_path="$(command -v "tmuxifier-$command")" fi fi