From d48e45396f5eff05badf6ff4c5ff7e0971d592e3 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 23 Jan 2017 15:26:29 +0000 Subject: [PATCH] cargo-completion: import from homebrew/completions. --- Formula/cargo-completion.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Formula/cargo-completion.rb diff --git a/Formula/cargo-completion.rb b/Formula/cargo-completion.rb new file mode 100644 index 0000000000..50c945c935 --- /dev/null +++ b/Formula/cargo-completion.rb @@ -0,0 +1,23 @@ +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.15.0.tar.gz" + version "20161222.0.15.0" + sha256 "6ebe9e0de255d5bd912528bef0f57db7746e162c6d9875a89c6c8b2b40a21d64" + + 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