.local/share/bash-completion/completions/npm
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 11 Dec 2023 00:27:20 +0200
changeset 1037 b386e087b97f
parent 1036 5b1ba85724fd
permissions -rw-r--r--
Added workaround for Cygwin, npm authors explicitly forbids it: npm/lib/commands/completion.js if (isWindowsShell) { const msg = 'npm completion supported only in MINGW / Git bash on Windows' throw Object.assign(new Error(msg), {

if [[ $OSTYPE = cygwin ]]; then
  # eval "$(MSYSTEM=MINGW64 npm completion | tr -d $'\r')"
  _npm_completion () {
    IFS=$'\n' COMPREPLY=( $(MSYSTEM=MINGW64 COMP_CWORD="$COMP_CWORD" COMP_LINE="$COMP_LINE" COMP_POINT="$COMP_POINT" npm completion -- "${COMP_WORDS[@]}" 2>/dev/null) )
  }
  complete -o default -F _npm_completion npm
else
  eval "$(npm completion)"
fi