fork/fish-shell

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

Fabian BoehmMake functions, completions and tests resilient to running on an embed-data fish329cd7d42

master
7.7 KiB117 linesraw
1# Yarn 1.22.4
2
3__fish_npm_helper
4set -l yarn_add "yarn global add"
5
6# Typically there is no need to check if (commandline -ct) begins with `--`
7# because it won't be matched. But we can prevent the slowdown from getting
8# a list of all packages and filtering through it if we only do that when
9# completing what seems to be a package name.
10complete -f -c yarn -n '__fish_seen_subcommand_from remove; and not __fish_is_switch' -xa '(__npm_installed_local_packages)'
11complete -f -c yarn -n '__fish_seen_subcommand_from add; and not __fish_is_switch' -xa "(__npm_filtered_list_packages \"$yarn_add\")"
12
13complete -f -c yarn -n __fish_use_subcommand -a help -d 'Show available commands and flags'
14
15complete -f -c yarn -n __fish_use_subcommand -a add -d 'Add packages'
16complete -f -c yarn -n '__fish_seen_subcommand_from add' -l dev -s D
17complete -f -c yarn -n '__fish_seen_subcommand_from add' -l peer -s P
18complete -f -c yarn -n '__fish_seen_subcommand_from add' -l O -s O
19complete -f -c yarn -n '__fish_seen_subcommand_from add' -l exact -s E
20complete -f -c yarn -n '__fish_seen_subcommand_from add' -l tilde -s T
21
22complete -f -c yarn -n __fish_use_subcommand -a bin -d 'Show location of Yarn `bin` folder'
23
24complete -f -c yarn -n __fish_use_subcommand -a cache -d 'Manage Yarn cache'
25complete -f -c yarn -n '__fish_seen_subcommand_from cache' -a clean
26
27complete -f -c yarn -n __fish_use_subcommand -a config -d 'Manage Yarn configuration'
28complete -f -c yarn -n '__fish_seen_subcommand_from config' -a 'set get delete list'
29
30complete -f -c yarn -n __fish_use_subcommand -a exec -d 'Run binaries'
31
32complete -f -c yarn -n __fish_use_subcommand -a info -d 'Show information about a package'
33
34complete -f -c yarn -n __fish_use_subcommand -a init -d 'Interactively create or update `package.json`'
35complete -f -c yarn -n '__fish_seen_subcommand_from init' -s y -l yes
36
37complete -f -c yarn -n __fish_use_subcommand -a install -d 'Install packages'
38
39complete -f -c yarn -n __fish_use_subcommand -a link -d 'Symlink a package'
40
41complete -f -c yarn -n __fish_use_subcommand -a list -d 'List installed packages'
42complete -f -c yarn -n '__fish_seen_subcommand_from list' -l depth
43
44complete -f -c yarn -n __fish_use_subcommand -a node -d 'Run Node with the hook already setup'
45
46complete -f -c yarn -n __fish_use_subcommand -a pack -d 'Create compressed archive of packages'
47
48complete -f -c yarn -n __fish_use_subcommand -a remove -d 'Remove packages'
49complete -f -c yarn -n __fish_use_subcommand -a run -d 'Run a defined package script'
50
51function __fish_yarn_run
52    if test -e package.json; and set -l python (__fish_anypython)
53        # Warning: That weird indentation is necessary, because python.
54        $python -S -c 'import json, sys; data = json.load(sys.stdin);
55for k,v in data["scripts"].items(): print(k + "\t" + v[:18])' <package.json 2>/dev/null
56    else if test -e package.json; and type -q jq
57        jq -r '.scripts | to_entries | map("\(.key)\t\(.value | tostring | .[0:20])") | .[]' package.json
58    else if type -q jq
59        # Yarn is quite slow and still requires `jq` because the normal format is unusable.
60        command yarn run --json 2>/dev/null | jq -r '.data.hints? | to_entries | map("\(.key)\t\(.value | tostring |.[0:20])") | .[]'
61    end
62end
63
64# Scripts can be used like normal subcommands, or with `yarn run SCRIPT`.
65complete -c yarn -n '__fish_use_subcommand; or __fish_seen_subcommand_from run' -xa "(__fish_yarn_run)"
66
67complete -f -c yarn -n __fish_use_subcommand -a unlink -d 'Unlink a previously created symlink'
68complete -f -c yarn -n __fish_use_subcommand -a unplug -d 'Force unpack packages'
69complete -f -c yarn -n __fish_use_subcommand -a up -d 'Upgrade packages'
70complete -f -c yarn -n __fish_use_subcommand -a upgrade-interactive -d 'Upgrade packages interactively'
71
72complete -f -c yarn -n __fish_use_subcommand -a version -d 'Update the package version'
73complete -f -c yarn -n '__fish_seen_subcommand_from version' -l new-version
74complete -f -c yarn -n '__fish_seen_subcommand_from version' -l message
75complete -f -c yarn -n '__fish_seen_subcommand_from version' -l no-git-tag-version
76
77complete -f -c yarn -n __fish_use_subcommand -a why -d 'Show why a package is installed'
78complete -f -c yarn -n __fish_use_subcommand -a workspace -d 'Manage workspace packages'
79complete -f -c yarn -n __fish_use_subcommand -a workspaces -d 'Show workspaces information'
80
81# These are the yarn commands all of them use the same options
82set -g yarn_cmds add bin cache config exec info init install link node pack remove run unlink unplug up upgrade-interactive version why workspace workspaces
83
84# Common short, long options
85complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l help -s h -d 'output usage information'
86complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l version -s V -d 'output the version number'
87
88# The rest of common options are all of them long
89complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l verbose -d 'output verbose messages on internal operations'
90complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l offline -d 'trigger an error if any required dependencies are not available in local cache'
91complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l prefer-offline -d 'use network only if dependencies are not available in local cache'
92complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l strict-semver
93complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l json
94complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l ignore-scripts -d 'don\'t run lifecycle scripts'
95complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l har -d 'save HAR output of network traffic'
96complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l ignore-platform -d 'ignore platform checks'
97complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l ignore-engines -d 'ignore engines check'
98complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l ignore-optional -d 'ignore optional dependencies'
99complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l force -d 'ignore all caches'
100complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l no-bin-links -d 'don\'t generate bin links when setting up packages'
101complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l flat -d 'only allow one version of a package'
102complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l 'prod production'
103complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l no-lockfile -d 'don\'t read or generate a lockfile'
104complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l pure-lockfile -d 'don\'t generate a lockfile'
105complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l frozen-lockfile -d 'don\'t generate a lockfile and fail if an update is needed'
106complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l global-folder
107complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l modules-folder -d 'install modules here instead of node_modules'
108complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l cache-folder -d 'specify a custom folder to store the yarn cache'
109
110complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l mutex -d 'use a mutex to ensure only one yarn instance is executing'
111complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l mutex -a 'file network'
112
113complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l no-emoji -d 'disable emoji in output'
114complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l proxy
115complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l https-proxy
116complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l no-progress -d 'disable progress bar'
117complete -c yarn -n '__fish_seen_subcommand_from $yarn_cmds' -l network-concurrency -d 'maximum number of concurrent network requests'