47 lines
1.6 KiB
Ruby
47 lines
1.6 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.21.1.tar.gz"
|
|
sha256 "47adf138f17c45d390af81958bdff6f92157d41e2c4cb13773df078b905cdaf4"
|
|
license "MIT"
|
|
head "https://github.com/junegunn/fzf.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "733f79496c3246979ca05eeb5677a5fd9e8ec532e69e8b2012102cacddba8ae6" => :catalina
|
|
sha256 "3c03bb9715be153a0f776d06cf4acd436ad4faa4266f7bd875a0d37594291516" => :mojave
|
|
sha256 "d15a616156eb92071f1cfc50f10366532af92ca1635d309162141ad67f785865" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
uses_from_macos "ncurses"
|
|
|
|
def install
|
|
ENV["GOPATH"] = HOMEBREW_CACHE/"go_cache"
|
|
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
|