blob: e037ae480ed3b2d11699c32bfc2ff664fa740539 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
# fish (http://fishshell.org) completion script for brew(1)
# To install, symlink into (brew --prefix)/share/fish/completions
# or ~/.config/fish/completions with the name 'brew.fish'
# e.g.:
# mkdir -p ~/.config/fish/completions
# ln -s (brew --prefix)/Library/Contributions/brew_fish_completion.fish
# ~/.config/fish/completions/brew.fish
for command in (ls (brew --repository)/Library/Homebrew/cmd | sed -e "s/\.rb//g")
set commands $command $commands
end
for command in (ls -p (brew --repository)/Library/Contributions/cmd | sed -e "s/\.rb//g" -e "s/brew-//g" -e "s/.*\///g")
set commands $command $commands
end
for command in abv ln ls remove rm
set commands $command $commands
end
function __fish_complete_brew_argument
set arguments (commandline -opc)
for cmd in $arguments
if contains -- $cmd abv audit cat deps edit fetch home homepage info install log ls list options uses versions --cache --cellar --prefix
ls (brew --repository)/Library/Formula 2>/dev/null | sed 's/\.rb//g'
ls (brew --repository)/Library/Aliases 2>/dev/null | sed 's/\.rb//g'
for dir in (ls (brew --repository)/Library/Taps 2>/dev/null)
set tap (echo "$dir" | sed 's|-|/|g')
ls -1R (brew --repository)/Library/Taps/$dir 2>/dev/null | grep '.\+.rb' | sed -E 's|(.+).rb|'"$tap"'/\1|g'
end
return 0
end
if contains -- $cmd cleanup link ln missing rm remove test unlink uninstall upgrade
ls (brew --prefix)/Cellar
return 0
end
if contains -- $cmd tap
brew ls-taps
return 0
end
if contains -- $cmd untap
ls (brew --repository)/Library/Taps 2>/dev/null | sed 's/-/\//g'
return 0
end
end
end
function __fish_complete_brew_has_command
set arguments (commandline -opc)
if [ (count $arguments) = 1 ]
return 1
end
for cmd in $arguments
if contains -- $cmd $commands
return 0
end
end
return 1
end
function __fish_complete_brew_command
set arguments (commandline -opc)
for item in $argv
if contains -- $item $arguments
return 0
end
end
return 1
end
function __fish_complete_brew_no_command
for cmd in (commandline -opc)
if contains -- $cmd $commands
return 1
end
end
return 0
end
function __fish_brew_formula_arguments
set formulae (ls (brew --repository)/Library/Formula 2>/dev/null | sed 's/\.rb//g')
for formula in (ls (brew --repository)/Library/Aliases 2>/dev/null | sed 's/\.rb//g')
set formulae $formula $formulae
end
for cmd in (commandline -opc)
if contains -- $cmd $formulae
brew options $cmd --compact | tr ' ' '\n'
end
end
end
complete -c brew --arguments '(__fish_brew_formula_arguments)'
complete -c brew -x -a "$commands" -n '__fish_complete_brew_no_command'
complete -c brew -x -a '(__fish_complete_brew_argument)' -n '__fish_complete_brew_has_command'
complete -c brew -s f -l force -n '__fish_complete_brew_command cleanup' -d "Remove out-of-date keg-only brews"
complete -c brew -s n -l dry-run -n '__fish_complete_brew_command cleanup' -d "Show what would be removed, but don't do anything"
complete -c brew -s s -n '__fish_complete_brew_command cleanup' -d "Remove all downloads"
complete -c brew -l autotools -n '__fish_complete_brew_command create' -d "Use autotools template"
complete -c brew -l cmake -n '__fish_complete_brew_command create' -d "Use cmake template"
complete -c brew -l no-fetch -n '__fish_complete_brew_command create' -d "Do not download URL"
complete -c brew -l 1 -n '__fish_complete_brew_command deps' -d "Only show dependencies one level down"
complete -c brew -s n -n '__fish_complete_brew_command deps' -d "Show dependencies in topological order"
complete -c brew -l tree -n '__fish_complete_brew_command deps' -d "Show dependencies as a tree"
complete -c brew -l all -n '__fish_complete_brew_command deps' -d "Show dependencies for all formulae"
complete -c brew -l set-name -n '__fish_complete_brew_command diy' -d "Set package name" -f
complete -c brew -l set-version -n '__fish_complete_brew_command diy' -d "Set package version" -f
complete -c brew -n '__fish_complete_brew_command doctor' -f
complete -c brew -n '__fish_complete_brew_command edit' -x
complete -c brew -s f -l force -n '__fish_complete_brew_command fetch' -d "Always redownload"
complete -c brew -l HEAD -n '__fish_complete_brew_command fetch' -d "Download HEAD version"
complete -c brew -l deps -n '__fish_complete_brew_command fetch' -d "Download dependencies"
complete -c brew -n '__fish_complete_brew_command home' -x
complete -c brew -l all -n '__fish_complete_brew_command info abv' -d "Show info for all formulae"
complete -c brew -l github -n '__fish_complete_brew_command info abv' -d "Open GitHub History page in browser" -x
complete -c brew -s d -l debug -n '__fish_complete_brew_command install' -d "Open a shell if install fails"
complete -c brew -s f -l force -n '__fish_complete_brew_command force' -d "Install formula even if blacklisted"
complete -c brew -s i -l interactive -n '__fish_complete_brew_command install' -d "Open a subshell to install manually"
complete -c brew -l git -n '__fish_complete_brew_command install' -d 'Create a git repo (useful for making patches)'
complete -c brew -l fresh -n '__fish_complete_brew_command install' -d "Do not reuse options from previous installs"
complete -c brew -l use-clang -n '__fish_complete_brew_command install' -d "Attempt to compile using Clang"
complete -c brew -l use-llvm -n '__fish_complete_brew_command install' -d "Attempt to compile using LLVM"
complete -c brew -l use-gcc -n '__fish_complete_brew_command install' -d "Attempt to compile using GCC"
complete -c brew -l build-from-source -n '__fish_complete_brew_command install' -d "Compile from source even if a bottle is provided"
complete -c brew -l devel -n '__fish_complete_brew_command install' -d "Install the development version"
complete -c brew -l HEAD -n '__fish_complete_brew_command install' -d "Install the HEAD version"
complete -c brew -s f -l force -n '__fish_complete_brew_command link ln' -d "Overwrite files while linking"
complete -c brew -s n -l dry-run -n '__fish_complete_brew_command link ln' -d "Show which files would be deleted"
complete -c brew -l unbrewed -n '__fish_complete_brew_command list ls' -d "List files in Homebrew prefix not installed by Homebrew"
complete -c brew -l versions -n '__fish_complete_brew_command list ls' -d "Show the version number for specified formulae"
complete -c brew -n '__fish_complete_brew_command log' -u
complete -c brew -l compact -n '__fish_complete_brew_command options' -d "Show options on a single line"
complete -c brew -l all -n '__fish_complete_brew_command options' -f -d "Show options for all formulae"
complete -c brew -l installed -n '__fish_complete_brew_command options' -f -d "Show options for all installed formulae"
complete -c brew -l quiet -n '__fish_complete_brew_command outdated' -d "Do not print names of outdated brews"
complete -c brew -s f -l force -n '__fish_complete_brew_command uninstall rm remove' -d "Delete all installed versions"
complete -c brew -l macports -n '__fish_complete_brew_command search' -d "Search Macports package search page"
complete -c brew -l fink -n '__fish_complete_brew_command search' -d "Search Fink package search page"
complete -c brew -l rebase -n '__fish_complete_brew_command update' -d "Use git pull --rebase"
complete -c brew -l installed -n '__fish_complete_brew_command uses' -d "Only list installed formulae"
complete -c brew -l compact -n '__fish_complete_brew_command versions' -d "Show all versions on a single line"
complete -c brew -s v -l verbose -d "Print extra debugging information"
|