Skip to content
Browse files

Dump logs to a temp file, and only if requested.

  • Loading branch information...
1 parent ba10afd commit 0ceb4499775c5cc8e13c761f7c783c471bd65e31 @isaacs isaacs committed Dec 3, 2010
Showing with 8 additions and 3 deletions.
  1. +8 −3 npm-completion.sh
View
11 npm-completion.sh
@@ -19,7 +19,12 @@ COMP_WORDBREAKS=${COMP_WORDBREAKS/@/}
export COMP_WORDBREAKS
__npm_completion () {
COMPREPLY=()
- local cur prev opts
+ local cur prev opts logfile
+ if [ "${loglevel:-silent}" == "silent" ]; then
+ logfile=/dev/null
+ else
+ logfile=/tmp/npm-completion.log
+ fi
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# opts=$(npm complete --loglevel silent --color false -- "$cur")
@@ -28,9 +33,9 @@ __npm_completion () {
COMP_POINT=$COMP_POINT \
COMP_WORDBREAKS=$COMP_WORDBREAKS \
COMP_WORDS="${COMP_WORDS[@]}" \
- npm completion --color false --loglevel warn \
+ npm completion --color false --loglevel "${loglevel:-silent}" \
-- "${COMP_WORDS[@]}" \
- 2>>./npm-completion.log ) )
+ 2>>$logfile ) )
return $?
}

0 comments on commit 0ceb449

Please sign in to comment.
Something went wrong with that request. Please try again.