From 3b5aab6edb0aea3a02383a74479c7afacb0e76f0 Mon Sep 17 00:00:00 2001 From: Stefan Maric Date: Mon, 7 Sep 2015 10:33:09 -0430 Subject: Complete list of available scripts for npm run/run-script command --- share/completions/npm.fish | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'share') diff --git a/share/completions/npm.fish b/share/completions/npm.fish index e2f7277e..ac0e264f 100644 --- a/share/completions/npm.fish +++ b/share/completions/npm.fish @@ -31,6 +31,11 @@ function __fish_npm_settings command npm config ls -l | command grep -o '.* =' | command tr -d '; ' | command tr -d ' =' end +# return everything that can be used with the npm run command +function __fish_npm_run + command npm run | command grep '^ [^ ]' | command tr -d ' ' +end + # cache complete -f -c npm -n '__fish_npm_needs_command' -a 'cache' -d "Manipulates package's cache" complete -f -c npm -n '__fish_npm_using_command cache' -a 'add' -d 'Add the specified package to the local cache' @@ -106,6 +111,10 @@ for c in 'up' 'update' complete -f -c npm -n "__fish_npm_using_command $c" -s g -l global -d 'Update global package(s)' end +# run +complete -f -c npm -n "__fish_npm_using_command run" -a '(__fish_npm_run)' +complete -f -c npm -n "__fish_npm_using_command run-script" -a '(__fish_npm_run)' + # misc shorter explanations complete -f -c npm -n '__fish_npm_needs_command' -a 'adduser add-user login' -d 'Add a registry user account' complete -f -c npm -n '__fish_npm_needs_command' -a 'bin' -d 'Display npm bin folder' -- cgit v1.2.3