From e6eb268a072fd4624a9e78b45983e3465d1454ab Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 23 Apr 2020 21:31:49 +0900 Subject: [PATCH] Improve node inspect completion It should be completed only after 'node' --- src/_node | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/_node b/src/_node index ac8fe68..9fe5abd 100644 --- a/src/_node +++ b/src/_node @@ -52,6 +52,15 @@ _node_files() { _files -g "*.(js|mjs)" } +_node_args() { + if (( CURRENT == 2 )); then + _alternative "_node_files" "_values 'command' 'inspect[enable inspector for debugging]'" + return + fi + + _node_files +} + local curcontext="$curcontext" state line ret=1 typeset -A opt_args @@ -150,10 +159,7 @@ _arguments -C \ '(- 1 *)'{-p,--print}'[evaluate script and print result]:inline JavaScript' \ '*'{-r,--require}'[module to preload (option can be repeated)]: :_node_files' \ '(- 1 *)'{-v,--version}'[print Node.js version]' \ - '*: :_node_files' && ret=0 - -_values 'commands' \ - 'inspect[enable inspector for debugging]' && ret=0 + '*: :_node_args' && ret=0 return ret