mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Avoid exiting with a cleaner syntax for commands that might fail
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user