48 lines
1.7 KiB
Ruby
48 lines
1.7 KiB
Ruby
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.3.tar.gz"
|
|
sha256 "e843904417adf926613431e4403fded24fade56269446e92aac6ff1db86af81e"
|
|
head "https://github.com/junegunn/fzf.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "81658f0f3113ff48873fe7bbc79338f1f50284c5a2f2da456047670d4350221b" => :high_sierra
|
|
sha256 "f430afe26c931e0d5b210793cd2daa98a24551868fc16501c67209042535c5c2" => :sierra
|
|
sha256 "c32dd7988d5c606fb790f59fe57f9cca9c40eddf8c187ff7a95c56f81b1c02f8" => :el_capitan
|
|
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
|