class Fzf < Formula desc "Command-line fuzzy finder written in Go" homepage "https://github.com/junegunn/fzf" url "https://github.com/junegunn/fzf/archive/0.17.0.tar.gz" sha256 "23569faf64cd6831c09aad7030c8b4bace0eb7a979c580b33cc4e4f9ff303e29" head "https://github.com/junegunn/fzf.git" bottle do cellar :any_skip_relocation sha256 "b6be52e173c586f1abbac42f5195c2bb4a5cdeb6fc8463d49c9782e6410d594d" => :sierra sha256 "61d511d1a04844a01e428847be842058a0967ce3f3762c5ff104de7bf6a91574" => :el_capitan sha256 "90783c405a559cdee8f97c9a628cce8a523fd823e3e86f94e676acb6193d1678" => :yosemite end depends_on "glide" => :build depends_on "go" => :build def install ENV["GLIDE_HOME"] = buildpath/"glide_home" ENV["GOPATH"] = buildpath (buildpath/"src/github.com/junegunn").mkpath ln_s buildpath, buildpath/"src/github.com/junegunn/fzf" system "glide", "install" system "go", "build", "-o", bin/"fzf", "-ldflags", "-X main.revision=brew" prefix.install "install", "uninstall" (prefix/"shell").install %w[bash zsh fish].map { |s| "shell/key-bindings.#{s}" } (prefix/"shell").install %w[bash zsh].map { |s| "shell/completion.#{s}" } (prefix/"plugin").install "plugin/fzf.vim" man1.install "man/man1/fzf.1", "man/man1/fzf-tmux.1" bin.install "bin/fzf-tmux" end def caveats; <<-EOS.undent To install useful keybindings and fuzzy completion: #{opt_prefix}/install To use fzf in Vim, add the following line to your .vimrc: set rtp+=#{opt_prefix} EOS end test do (testpath/"list").write %w[hello world].join($INPUT_RECORD_SEPARATOR) assert_equal "world", shell_output("cat #{testpath}/list | #{bin}/fzf -f wld").chomp end end