From 4497b73ff5bc09f7164099f097d990a24636e2f3 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Thu, 30 Jun 2016 22:32:21 +0100 Subject: [PATCH] Check we have completions before setting them --- npm-run-completion.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/npm-run-completion.zsh b/npm-run-completion.zsh index e646796..4c22151 100644 --- a/npm-run-completion.zsh +++ b/npm-run-completion.zsh @@ -16,8 +16,10 @@ _npm_run_completion() { # If we have one, parse the scripts if [ ! "$dir" = "" ] && type node > /dev/null; then local options=("${(@f)$(node -e "var pkg = require('$dir/$filename'); pkg.scripts && Object.keys(pkg.scripts).forEach(function(script) { console.log(script.replace(':', '\\\:')+':$ '+pkg.scripts[script]) })")}") - _describe 'values' options - return + if [ ! "$#options" = 0 ]; then + _describe 'values' options + return + fi fi fi