homebrew-core/Formula/cargo-completion.rb

24 lines
747 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.16.0.tar.gz"
version "20170227.0.16.0"
sha256 "5f7a7669daea152e84bbf9e6d4ee0ccc6c8e49dd0042f546ba80629bbc0191a4"
head "https://github.com/rust-lang/cargo.git"
bottle :unneeded
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