fish-shell/share/completions/bower.fish
Mahmoud Al-Qudsi a733296980 Correct bower and yarn completions
bower was calling `__fish_should_complete_args`, the old name for
`__fish_should_complete_switches.`
yarn was parsing bower.json instead of package.json.
2018-04-20 09:12:34 -05:00

63 lines
2 KiB
Fish

function __bower_cmds
echo -en "cache\tManage bower cache
help\tDisplay help information about Bower
home\tOpens a package homepage into your favorite browser
info\tInfo of a particular package
init\tInteractively create a bower.json file
install\tInstall a package locally
link\tSymlink a package folder
list\tList local packages - and possible updates
login\tAuthenticate with GitHub and store credentials
lookup\tLook up a single package URL by name
prune\tRemoves local extraneous packages
register\tRegister a package
search\tSearch for packages by name
update\tUpdate a local package
uninstall\tRemove a local package
unregister\tRemove a package from the registry
version\tBump a package version
"
end
function __bower_args
echo -en "-f\tMakes various commands more forceful
--force\tMakes various commands more forceful
-j\tOutput consumable JSON
--json\tOutput consumable JSON
-l\tWhat level of logs to report
--loglevel\tWhat level of logs to report
-o\tDo not hit the network
--offline\tDo not hit the network
-q\tOnly output important information
--quiet\tOnly output important information
-s\tDo not output anything, besides errors
--silent\tDo not output anything, besides errors
-V\tMakes output more verbose
--verbose\tMakes output more verbose
--allow-root\tAllows running commands as root
-v\tOutput Bower version
--version\tOutput Bower version
--no-color\tDisable colors"
end
function __bower_matching_pkgs
bower search (commandline -ct) | string match -r "\S+[^\s]" | string match -v "Search"
end
# Output of `bower list` is a) slow, b) convoluted. Use `jq` instead.
function __bower_list_installed
if not type -q jq
return 1
end
if not test -e bower.json
return 1
end
jq -r '.dependencies | to_entries[] | .key' bower.json
end
complete -c bower -n "__fish_is_first_token" -x -a '(__bower_cmds)'
complete -c bower -n "__fish_should_complete_switches" -x -a '(__bower_args)'
complete -c bower -n "__fish_seen_subcommand_from install" -x -a '(__bower_matching_pkgs)'
complete -c bower -n "__fish_seen_subcommand_from uninstall" -x -a '(__bower_list_installed)'