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.5.tar.gz" sha256 "de3b39758e01b19bbc04ee0d5107e14052d3a32ce8f40d4a63d0ed311394f7ee" head "https://github.com/junegunn/fzf.git" bottle do cellar :any_skip_relocation sha256 "fbef178808dd3cee3b36ea3256579bc759e6516f87c4b8b2be00ad404ce14d4f" => :mojave sha256 "7307a392d1869453b5dbfa86b4b0bb4b1e8e6178d12fd928b82e9f8cfde3926d" => :high_sierra sha256 "490018ace4f9d99a470af3be3a409c793c1551fe72a6be2ad6e766dd594fa282" => :sierra 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 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