fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerMake __fish_is_nth_token and __fish_nth_token private again47b0d0c29

master
2.4 KiB70 linesraw
1function __bower_cmds
2    echo -en "cache\tManage bower cache
3help\tDisplay help information about Bower
4home\tOpens a package homepage into your favorite browser
5info\tInfo of a particular package
6init\tInteractively create a bower.json file
7install\tInstall a package locally
8link\tSymlink a package folder
9list\tList local packages - and possible updates
10login\tAuthenticate with GitHub and store credentials
11lookup\tLook up a single package URL by name
12prune\tRemoves local extraneous packages
13register\tRegister a package
14search\tSearch for packages by name
15update\tUpdate a local package
16uninstall\tRemove a local package
17unregister\tRemove a package from the registry
18version\tBump a package version
19"
20end
21
22function __bower_args
23    echo -en "-f\tMakes various commands more forceful
24--force\tMakes various commands more forceful
25-j\tOutput consumable JSON
26--json\tOutput consumable JSON
27-l\tWhat level of logs to report
28--loglevel\tWhat level of logs to report
29-o\tDo not hit the network
30--offline\tDo not hit the network
31-q\tOnly output important information
32--quiet\tOnly output important information
33-s\tDo not output anything, besides errors
34--silent\tDo not output anything, besides errors
35-V\tMakes output more verbose
36--verbose\tMakes output more verbose
37--allow-root\tAllows running commands as root
38-v\tOutput Bower version
39--version\tOutput Bower version
40--no-color\tDisable colors"
41end
42
43function __bower_matching_pkgs
44    bower search (commandline -ct) | string match -r "\S+[^\s]" | string match -v Search
45end
46
47# Output of `bower list` is a) slow, b) convoluted. Use `python` or `jq` instead.
48function __bower_list_installed
49    if not test -e bower.json
50        return 1
51    end
52
53    if set -l python (__fish_anypython)
54        # Warning: That weird indentation is necessary, because python.
55        $python -S -c 'import json, sys; data = json.load(sys.stdin);
56for k,v in data["dependencies"].items(): print(k + "\t" + v[:18])' <bower.json 2>/dev/null
57        return
58    end
59
60    if not type -q jq
61        return 1
62    end
63
64    jq -r '.dependencies | to_entries[] | .key' bower.json
65end
66
67complete -c bower -n "__fish_is_nth_token 1" -x -a '(__bower_cmds)'
68complete -c bower -n __fish_should_complete_switches -x -a '(__bower_args)'
69complete -c bower -n "__fish_seen_subcommand_from install" -x -a '(__bower_matching_pkgs)'
70complete -c bower -n "__fish_seen_subcommand_from uninstall" -x -a '(__bower_list_installed)'