fish completion: complete formula options
This commit is contained in:
parent
2446e5ee8a
commit
dbc472957f
@ -86,6 +86,20 @@ function __fish_complete_brew_no_command
|
||||
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'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user