Files
server/usr/libexec/nodenv/nodenv-completions
2026-01-07 20:52:11 +01:00

27 lines
570 B
Bash
Executable File

#!/usr/bin/env bash
# Usage: nodenv completions <command> [arg1 arg2...]
set -e
[ -n "$NODENV_DEBUG" ] && set -x
COMMAND="$1"
if [ -z "$COMMAND" ]; then
nodenv-help --usage completions >&2
exit 1
fi
# Provide nodenv completions
if [ "$COMMAND" = "--complete" ]; then
exec nodenv-commands
fi
COMMAND_PATH="$(command -v "nodenv-$COMMAND" || command -v "nodenv-sh-$COMMAND")"
# --help is provided automatically
echo --help
if grep -iE "^([#%]|--|//) provide nodenv completions" "$COMMAND_PATH" >/dev/null; then
shift
exec "$COMMAND_PATH" --complete "$@"
fi