This tap inherits the Homebrew contributions guidelines so please read them first.
See the Formula Cookbook. Reading existing formulae might help; see
e.g. grunt-completion.rb
, rake-completion.rb
or
docker-machine-completion.rb
.
If the target software is provided by an Homebrew formula and upstream provides
completion scripts it’s usually better to install them along with the software
instead of creating a separate formula here. See git.rb
for example.
Formulae should be named after the name of the software they target, e.g.
maven-completion
, rake-completion
, open-completion
.
Tests can be tricky here; for now we check that completing the software
triggers the completion function defined by the Bash script. If the software
defines a command foo
and the Bash script defines a function _foo
then the
following test should work:
test do
assert_match "-F _foo",
shell_output("source #{bash_completion}/foo && complete -p foo")
end
Some Bash completion scripts use Bash-only syntax. These need to be wrapped to work:
test do
assert_match "-F _foo",
shell_output("bash -c 'source #{bash_completion}/foo && complete -p foo'")
end