mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Add script values as descriptions to npm run/run-script completion
This commit is contained in:
parent
3b5aab6edb
commit
f898d82536
1 changed files with 6 additions and 7 deletions
|
@ -31,11 +31,6 @@ function __fish_npm_settings
|
||||||
command npm config ls -l | command grep -o '.* =' | command tr -d '; ' | command tr -d ' ='
|
command npm config ls -l | command grep -o '.* =' | command tr -d '; ' | command tr -d ' ='
|
||||||
end
|
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
|
# cache
|
||||||
complete -f -c npm -n '__fish_npm_needs_command' -a 'cache' -d "Manipulates package's 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'
|
complete -f -c npm -n '__fish_npm_using_command cache' -a 'add' -d 'Add the specified package to the local cache'
|
||||||
|
@ -112,8 +107,12 @@ for c in 'up' 'update'
|
||||||
end
|
end
|
||||||
|
|
||||||
# run
|
# run
|
||||||
complete -f -c npm -n "__fish_npm_using_command run" -a '(__fish_npm_run)'
|
command npm run | command tail -n +2 | command sed "s/^ *//" | while read -l name
|
||||||
complete -f -c npm -n "__fish_npm_using_command run-script" -a '(__fish_npm_run)'
|
set -l trim 20
|
||||||
|
read -l value
|
||||||
|
complete -f -c npm -n "__fish_npm_using_command run" -a (printf "%s " "$name") -d (echo "$value" | cut -c1-$trim)
|
||||||
|
complete -f -c npm -n "__fish_npm_using_command run-script" -a (printf "%s " "$name") -d (echo "$value" | cut -c1-$trim)
|
||||||
|
end
|
||||||
|
|
||||||
# misc shorter explanations
|
# 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 'adduser add-user login' -d 'Add a registry user account'
|
||||||
|
|
Loading…
Reference in a new issue