homebrew-core/Formula/cargo-completion.rb
2017-09-10 14:27:53 -04:00

24 lines
817 B
Ruby

class CargoCompletion < Formula
desc "Bash and Zsh completion for Cargo"
homepage "https://github.com/rust-lang/cargo"
url "https://github.com/rust-lang/cargo/archive/0.21.1.tar.gz"
sha256 "f2464d3cb3e431e45191b6f70e415c320d227ef3c3d134cea4e86357c0c72a33"
version_scheme 1
head "https://github.com/rust-lang/cargo.git"
bottle :unneeded
conflicts_with "rust", :because => "both install shell completion for cargo"
def install
bash_completion.install "src/etc/cargo.bashcomp.sh" => "cargo"
zsh_completion.install "src/etc/_cargo"
end
test do
# we need to define a dummy 'cargo' command to force the script to define
# the completion function
assert_match "-F _cargo",
shell_output("cargo() { true;} && source #{bash_completion}/cargo && complete -p cargo")
end
end