SHA256
1
0
forked from pool/fzf
fzf/fzf.spec
Matej Cepl f90795fc1e - Update to version 0.40.0:
- Added `zero` event that is triggered when there's no match
    ```sh
    # Reload the candidate list when there's no match
    echo $RANDOM | fzf --bind 'zero:reload(echo $RANDOM)+clear-query' --height 3
    ```
  - New actions
      - Added `track` action which makes fzf track the current item when the
        search result is updated. If the user manually moves the cursor, or the
        item is not in the updated search result, tracking is automatically
        disabled. Tracking is useful when you want to see the surrounding items
        by deleting the query string.
        ```sh
        # Narrow down the list with a query, point to a command,
        # and hit CTRL-T to see its surrounding commands.
        export FZF_CTRL_R_OPTS="
          --preview 'echo {}' --preview-window up:3:hidden:wrap
          --bind 'ctrl-/:toggle-preview'
          --bind 'ctrl-t:track+clear-query'
          --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'
          --color header:italic
          --header 'Press CTRL-Y to copy command into clipboard'"
        ```
      - Added `change-header(...)`
      - Added `transform-header(...)`
      - Added `toggle-track` action
  - Fixed `--track` behavior when used with `--tac`
      - However, using `--track` with `--tac` is not recommended. The resulting
        behavior can be very confusing.
  - Bug fixes and improvements

OBS-URL: https://build.opensuse.org/package/show/utilities/fzf?expand=0&rev=72
2023-04-30 21:46:48 +00:00

187 lines
5.3 KiB
RPMSpec

#
# spec file for package fzf
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global _lto_cflags %nil
Name: fzf
Version: 0.40.0
Release: 0
Summary: A command-line fuzzy finder
License: MIT
Group: Productivity/File utilities
URL: https://github.com/junegunn/fzf
Source0: https://github.com/junegunn/fzf/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: vendor.tar.zst
BuildRequires: zstd
BuildRequires: golang(API) = 1.19
%description
fzf is an interactive Unix filter for command-line that can be used with any list; files,
command history, processes, hostnames, bookmarks, git commits, etc.
%package tmux
Summary: Tmux integration for fzf
Group: Productivity/File utilities
Supplements: (fzf and tmux)
BuildArch: noarch
%description tmux
Tmux integration for fzf. Includes a wrapper script, fzf-tmux, that opens your list in a
separate tmux pane.
%package bash-completion
Summary: Bash completion for fzf
Group: Productivity/File utilities
Requires: bash-completion
Requires: fzf
Supplements: (fzf and bash-completion)
BuildArch: noarch
%description bash-completion
Bash shell completions for fzf
%package fish-completion
Summary: Fish completion for fzf
Group: Productivity/File utilities
Requires: fish
Requires: fzf
Supplements: (fzf and fish)
BuildArch: noarch
%description fish-completion
fish shell completions for fzf
To enable it, ensure you have a file ~/.config/fish/functions/fish_user_key_bindings.fish
which contains:
function fish_user_key_bindings
fzf_key_bindings
end
(or append fzf_key_bindings to the fish_user_key_bindings function if the file already exists)
%package zsh-completion
Summary: ZSH completion for fzf
Group: Productivity/File utilities
Requires: fzf
Requires: zsh
Supplements: (fzf and zsh)
BuildArch: noarch
%description zsh-completion
zsh shell completions for fzf
%define vimplugin_dir %{_datadir}/vim/site
%package -n vim-fzf
Summary: Vim plugin for fzf
Group: Productivity/File utilities
Requires: (vim or neovim)
BuildArch: noarch
%description -n vim-fzf
Plugin for vim allowing use of fzf.
%prep
%autosetup -p1 -a1
# fix E: env-script-interpreter
sed -i 's,#!%{_bindir}/env ,#!/bin/,' ./bin/fzf-tmux
%build
export FZF_VERSION=%{version} FZF_REVISION=tarball
export GOCACHE=$(readlink -f vendor/)
%ifarch ppc64
BUILDMOD=""
%else
BUILDMOD="-buildmode=pie"
%endif
export RPM_OPT_FLAGS="%{optflags}"
go build -v -x -mod=vendor $BUILDMOD -a -ldflags "-s -X main.revision=%{version}"
%install
install -Dm755 fzf %{buildroot}%{_bindir}/fzf
install -Dm755 bin/fzf-tmux %{buildroot}%{_bindir}/fzf-tmux
install -Dm644 man/man1/fzf.1 %{buildroot}%{_mandir}/man1/fzf.1
install -Dm644 man/man1/fzf-tmux.1 %{buildroot}%{_mandir}/man1/fzf-tmux.1
# shell completions
install -Dm0644 shell/completion.bash \
%{buildroot}%{_datadir}/bash-completion/completions/fzf
install -Dm0644 shell/key-bindings.bash \
%{buildroot}%{_datadir}/bash-completion/completions/fzf-key-bindings
install -Dm0644 shell/completion.zsh \
%{buildroot}%{_datadir}/zsh/site-functions/_fzf
install -Dm0644 shell/key-bindings.zsh \
%{buildroot}%{_sysconfdir}/zsh_completion.d/fzf-key-bindings
install -Dm0644 shell/key-bindings.fish \
%{buildroot}%{_datadir}/fish/vendor_functions.d/fzf_key_bindings.fish
# vim plugin
install -D -m0644 -t %{buildroot}%{vimplugin_dir}/doc doc/*
install -D -m0644 -t %{buildroot}%{vimplugin_dir}/plugin plugin/*
%check
export SHELL=/bin/sh GOOS=
export GOCACHE=$(readlink -f vendor/)
%ifarch ppc64
BUILDMOD=""
%else
BUILDMOD="-buildmode=pie"
%endif
export CGO_CFLAGS="%{optflags}"
export CGO_CXXFLAGS="%{optflags}"
export CGO_CPPFLAGS="%{optflags}"
go test -v -x -mod=vendor ${BUILDMOD} -a \
-ldflags "-X main.revision=%{version}" \
github.com/junegunn/fzf/src \
github.com/junegunn/fzf/src/algo \
github.com/junegunn/fzf/src/tui \
github.com/junegunn/fzf/src/util
%files
%doc README.md
%{_bindir}/fzf
%{_mandir}/man1/fzf.1%{?ext_man}
%license LICENSE
%files tmux
%{_bindir}/fzf-tmux
%{_mandir}/man1/fzf-tmux.1%{?ext_man}
%files bash-completion
%{_datadir}/bash-completion/completions/fzf
%{_datadir}/bash-completion/completions/fzf-key-bindings
%files fish-completion
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_functions.d
%{_datadir}/fish/vendor_functions.d/fzf_key_bindings.fish
%files zsh-completion
%{_datadir}/zsh
%dir %{_sysconfdir}/zsh_completion.d
%config %{_sysconfdir}/zsh_completion.d/fzf-key-bindings
%files -n vim-fzf
%doc README-VIM.md
%dir %{_datadir}/vim
%dir %{vimplugin_dir}
%{vimplugin_dir}/doc
%{vimplugin_dir}/plugin
%changelog