mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Misc. code cleanup and minor improvement to help command
This commit is contained in:
@@ -20,13 +20,12 @@ has-completions() {
|
|||||||
grep -i "^# Provide tmuxifier completions" "$1" >/dev/null
|
grep -i "^# Provide tmuxifier completions" "$1" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
command="$1"
|
if [ -z "$1" ]; then
|
||||||
if [ -z "$command" ]; then
|
|
||||||
echo "$(tmuxifier-help completions)" >&2
|
echo "$(tmuxifier-help completions)" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
! command_path="$(tmuxifier-resolve-command-path "$command")"
|
! command_path="$(tmuxifier-resolve-command-path "$1")"
|
||||||
|
|
||||||
if [ -n "$command_path" ] && has-completions "$command_path"; then
|
if [ -n "$command_path" ] && has-completions "$command_path"; then
|
||||||
shift
|
shift
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ has-help() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
command="$1"
|
command="$1"
|
||||||
if [ -z "$command" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "usage: tmuxifier <command> [<args>]
|
echo "usage: tmuxifier <command> [<args>]
|
||||||
|
|
||||||
Some useful tmuxifier commands are:
|
Some useful tmuxifier commands are:
|
||||||
@@ -41,10 +41,10 @@ See 'tmuxifier help <command>' for information on a specific command."
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
! command_path="$(tmuxifier-resolve-command-path "$command")"
|
! command_path="$(tmuxifier-resolve-command-path "$1")"
|
||||||
|
|
||||||
if [ -z "$command_path" ]; then
|
if [ -z "$command_path" ]; then
|
||||||
echo "tmuxifier: no such command '$command'" >&2
|
echo "tmuxifier: no such command '$1'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -52,6 +52,8 @@ if has-help "$command_path"; then
|
|||||||
shift
|
shift
|
||||||
exec "$command_path" --help "$@"
|
exec "$command_path" --help "$@"
|
||||||
else
|
else
|
||||||
|
command="$(basename "$command_path")"
|
||||||
|
command="${command/tmuxifier\-/}"
|
||||||
echo "Sorry, the '$command' command isn't documented yet."
|
echo "Sorry, the '$command' command isn't documented yet."
|
||||||
echo ""
|
echo ""
|
||||||
echo "You can view the command's source here:"
|
echo "You can view the command's source here:"
|
||||||
|
|||||||
Reference in New Issue
Block a user