mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
Add completions for bower
These are "true" completions, with dynamic completion of available packages to be installed or removed.
This commit is contained in:
parent
7db0958804
commit
e48722f0bf
2 changed files with 67 additions and 2 deletions
|
@ -61,6 +61,7 @@ This section is for changes merged to the `major` branch that are not also merge
|
|||
- Command substitution output is now limited to 10 MB by default (#3822).
|
||||
- Added completions for
|
||||
- `bd` (#4472)
|
||||
- `bower`<sup>∗</sup>
|
||||
- `configure`
|
||||
- `j` (autojump #4344)
|
||||
- `jhipster` (#4472)
|
||||
|
@ -72,9 +73,10 @@ This section is for changes merged to the `major` branch that are not also merge
|
|||
- `git` (#4395, #4396, #4592)
|
||||
- `npm`<sup>†</sup>
|
||||
- `ssh` (#4344)
|
||||
- `yarn`<sup>†</sup>
|
||||
- `yarn`<sup>∗</sup><sup>†</sup>
|
||||
|
||||
_† for autocompletion of available packages for installation via `npm` or `yarn`, make sure `all-the-package-names` is installed (typically: `sudo npm install -g all-the-package-names`)._
|
||||
∗ _`jq` must be installed to complete the list of currently installed `bower` or `yarn` packages_. <br/>
|
||||
† _to autocomplete the list of packages available for installation with `npm` or `yarn`, `all-the-package-names` must be installed (typically: `sudo npm install -g all-the-package-names`)._
|
||||
|
||||
--
|
||||
|
||||
|
|
63
share/completions/bower.fish
Normal file
63
share/completions/bower.fish
Normal file
|
@ -0,0 +1,63 @@
|
|||
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_args" -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)'
|
Loading…
Reference in a new issue