yarn run tab completion

completes #4597
This commit is contained in:
Niraj Thapaliya 2017-12-14 22:13:09 -06:00
parent 7cd9c3b2bf
commit 0c2d939e02

View file

@ -64,6 +64,16 @@ complete -f -c yarn -n '__fish_seen_subcommand_from publish' -l tag
complete -f -c yarn -n '__fish_use_subcommand' -a remove
complete -f -c yarn -n '__fish_use_subcommand' -a run
function __fish_yarn_run
if test -e package.json; and type -q jq
jq -r '.scripts | to_entries | map("\(.key)\t\(.value | tostring | .[0:20])") | .[]' package.json
else if type -q jq
command yarn run --json 2> /dev/null | jq -r '.data.hints? | to_entries | map("\(.key)\t\(.value | tostring |.[0:20])") | .[]'
end
end
complete -f -c yarn -n '__fish_seen_subcommand_from run' -a "(__fish_yarn_run)"
complete -f -c yarn -n '__fish_use_subcommand' -a tag
complete -f -c yarn -n '__fish_seen_subcommand_from tag' -a 'add rm ls'