Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 2.05 KB

CONTRIBUTING.md

File metadata and controls

49 lines (39 loc) · 2.05 KB

Contributing to Homebrew-completions

This tap inherits the Homebrew contributions guidelines so please read them first.

Adding a formula

See the Formula Cookbook. Reading existing formulae might help; see e.g. grunt-completion.rb, rake-completion.rb or docker-machine-completion.rb.

Avoid Duplicates

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.

Naming a formula

Formulae should be named after the name of the software they target, e.g. maven-completion, rake-completion, open-completion.

Writing a test

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