#!/usr/bin/env bash # Usage: basher completions # Summary: List completions for a command. # # In order to support completions, a command must have a comment # with the 'completions' TAG and provide a '--completions' argument. set -e COMMAND="$1" if [ -z "$COMMAND" ]; then basher-help completions exit 1 fi COMMAND_PATH="$(command -v "basher-$COMMAND")" if grep -E "^([#%]|--|//) TAG completions" "$COMMAND_PATH" >/dev/null; then exec "$COMMAND_PATH" --complete fi