aboutsummaryrefslogtreecommitdiff
path: root/libexec/recit-completions
blob: 2384dc3c84c86055ef9a733f1e7c01606d569770 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env bash
set -e

COMMAND="$1"
if [ -z "$COMMAND" ]; then
  echo "usage: recit completions COMMAND [arg1 arg2...]" >&2
  exit 1
fi

COMMAND_PATH="$(command -v "recit-$COMMAND")"
if grep -i "^# provide recit completions" "$COMMAND_PATH" >/dev/null; then
  shift
  exec "$COMMAND_PATH" --complete "$@"
fi