#! /usr/bin/env bash set -e [ -n "$TMUXIFIER_DEBUG" ] && set -x # Provide tmuxifier help if [ "$1" == "--help" ]; then echo "usage: tmuxifier completion Print a list of available completions for specified command." exit fi # Provide tmuxifier completions if [ "$1" == "--complete" ]; then tmuxifier-commands exit fi has-completions() { grep -i "^# Provide tmuxifier completions" "$1" >/dev/null } command="$1" if [ -z "$command" ]; then echo "$(tmuxifier-help completions)" >&2 exit 1 fi ! command_path="$(tmuxifier-resolve-command-path "$command")" if [ -n "$command_path" ] && has-completions "$command_path"; then shift exec "$command_path" --complete "$@" fi