fork/fish-shell

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

Fabio José BohnenbergerExtract __fish_cached function (#11526)43fbfa9a0

master
2.8 KiB75 linesraw
1function __fish_winetricks__complete_verbs
2    __fish_cached -t 3600 -- 'winetricks list-all 2>/dev/null' |
3        string match --invert --regex '^==' |
4        string match --invert --regex '^(apps|dlls|fonts|games|settings)$' |
5        string replace --regex '(\S+)\s+(.+)' '$1\t$2'
6end
7
8set -l command winetricks
9
10complete -c $command -f
11
12complete -c $command -s h -l help -d 'Show help'
13complete -c $command -s V -l version -d 'Show version'
14
15complete -c $command -l country -f -d 'Specify the country code'
16
17complete -c $command -s f -l force \
18    -d "Don't check whether packages were already installed"
19
20complete -c $command -l gui -d 'Show gui diagnostics'
21complete -c $command -l isolate -d 'Use the separate bottles for applications'
22complete -c $command -l self-update -d 'Update to the latest version'
23complete -c $command -l update-rollback -d 'Rollback the latest self-update'
24complete -c $command -s k -l keep_isos -d 'Cache ISOs'
25complete -c $command -l no-clean -d "Don't delete temporary directories"
26complete -c $command -s q -l unattended -d "Don't show any prompts"
27
28complete -c $command -s r -l ddrescue \
29    -d 'Reattempt when caching scratched discs'
30
31complete -c $command -s t -l torify -d 'Run downloads through torify'
32complete -c $command -l virefy -d 'Test verbs automaitally'
33complete -c $command -s v -l verbose -d 'Show commands'
34
35set -l subcommands_with_descriptions 'list\t"List categories"' \
36    'list-all\t"List categories and their verbs"' \
37    'apps\t"Interact with applications"' \
38    'benchmarks\t"Interact with benchmarks"' \
39    'dlls\t"Interact with DLLs"' \
40    'fonts\t"Interact with fonts"' \
41    'games\t"Interact with games"' \
42    'settings\t"Interact with settings"' \
43    'list-cached\t"Interact with list-cached"' \
44    'list-download\t"Interact with list-download"' \
45    'list-manual-download\t"Interact with list-manual-download"' \
46    'list-installed\t"Interact with list-installed"' \
47    'prefix\t"Specify the bottle"' \
48    'annihilate\t"Clear the bottle"'
49
50for architecture in 32 64
51    set -a subcommands_with_descriptions "arch=$architecture\t\"Specify the architecture\""
52end
53
54set -l subcommands (string replace --regex '\\\t.+' '' -- $subcommands_with_descriptions)
55set -l root_condition "not __fish_seen_subcommand_from $subcommands"
56
57complete -c $command -a "$subcommands_with_descriptions" -n $root_condition
58
59complete -c $command -a list \
60    -d 'List applications' \
61    -n '__fish_seen_subcommand_from apps'
62
63complete -c $command -a list \
64    -d 'List DLLs' \
65    -n '__fish_seen_subcommand_from dlls'
66
67for subcommand in benchmarks fonts games settings
68    complete -c $command -a list \
69        -d 'List $subcommand' \
70        -n '__fish_seen_subcommand_from dlls'
71end
72
73complete -c $command -a '(__fish_winetricks__complete_verbs)' \
74    -d 'Specify the verb or path to it' \
75    -n $root_condition