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.24.3.tar.gz"
|
|
sha256 "5643a21851b7f495cd33d42839f46f0e975b162aa7aa5f2079f8c25764be112a"
|
|
license "MIT"
|
|
head "https://github.com/junegunn/fzf.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "83135bde9feb6c530c56c450ed36de2972c88f0979cb46cdeb49e2ab725735bc" => :big_sur
|
|
sha256 "76bc4f0d19d68580704b4cf66a57650bcb9a18494b1c61f78770919be3a2b510" => :catalina
|
|
sha256 "23b75e0f9359bb9e69f52683fe7c847fc8a8b5e70f35fc5a68558d4d7b0e2cc3" => :mojave
|
|
sha256 "b5fc8fb3b2e0f24e5619697b5fb39432e193929554db370d14623cba064262fb" => :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.version=#{version} -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
|