Skip to content

Instantly share code, notes, and snippets.

@2no
Last active December 27, 2015 07:19
Show Gist options
  • Save 2no/7288280 to your computer and use it in GitHub Desktop.
Save 2no/7288280 to your computer and use it in GitHub Desktop.
npm の入力補完 ~/.config/fish/completions/npm.fish
#!fish
if not type npm >/dev/null 2>&1
exit
end
set -l cmds \
add-user adduser apihelp author bin bugs c cache completion config ddp \
dedupe deprecate docs edit explore faq find find-dupes get help help-search \
home i info init install isntall issues la link list ll ln login ls outdated \
owner pack prefix prune publish r rb rebuild remove repo restart rm root \
run-script s se search set show shrinkwrap star stars start stop submodule \
tag test tst un uninstall unlink unpublish unstar up update v version view \
whoami
for cmd in $cmds
complete -f -c npm -n '__fish_npm_using_command' -a $cmd
end
function __fish_npm_using_command
set cmd (commandline -opc)
[ (count $cmd) -gt 1 ] ;and return 1 ;or return 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment