Complete list of available scripts for npm run/run-script command

This commit is contained in:
Stefan Maric 2015-09-07 10:33:09 -04:30 committed by Fabian Homborg
parent 11c8a47d22
commit 3b5aab6edb

View file

@ -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'