mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 01:46:40 +00:00
@@ -31,6 +31,5 @@ case "$1" in
|
||||
echo "list-windows"
|
||||
;;
|
||||
* )
|
||||
echo "unknown alias \"$1\""
|
||||
exit 1
|
||||
esac
|
||||
|
||||
@@ -10,13 +10,11 @@ fi
|
||||
|
||||
command="$1"
|
||||
|
||||
# Lookup command, attempt to resolve as alias if fails
|
||||
! command_path="$(command -v "tmuxifier-$command")"
|
||||
if [ -z "$command_path" ]; then
|
||||
resolved="$(tmuxifier-alias "$command")"
|
||||
if [ ! -z "$resolved" ]; then
|
||||
# Ensure we have the correct command name in case an alias was given.
|
||||
if [ -n "$command" ]; then
|
||||
! resolved="$(tmuxifier-alias "$command")"
|
||||
if [ -n "$resolved" ]; then
|
||||
command="$resolved"
|
||||
! command_path="$(command -v "tmuxifier-$command")"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -111,14 +109,16 @@ Aliases: list-win, lsw
|
||||
List all window layouts."
|
||||
;;
|
||||
* )
|
||||
if [ ! -z "$command_path" ]; then
|
||||
! command_path="$(tmuxifier-resolve-command-path "$command")"
|
||||
if [ -n "$command_path" ]; then
|
||||
echo "Sorry, the '$command' command isn't documented yet."
|
||||
echo
|
||||
echo "You can view the command's source here:"
|
||||
echo "$command_path"
|
||||
echo
|
||||
else
|
||||
echo "tmuxifier: no such command '$command'"
|
||||
echo "tmuxifier: no such command '$command'" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
19
libexec/tmuxifier-resolve-command-path
Executable file
19
libexec/tmuxifier-resolve-command-path
Executable file
@@ -0,0 +1,19 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
! command_path="$(command -v "tmuxifier-$1")"
|
||||
if [ -z "$command_path" ]; then
|
||||
resolved="$(tmuxifier-alias "$1")"
|
||||
if [ -n "$resolved" ]; then
|
||||
! command_path="$(command -v "tmuxifier-$resolved")"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$command_path" ]; then
|
||||
echo "$command_path"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user