%global _default_patch_fuzz 2

# Generated by rust2rpm 26
%bcond_without check

%global crate hwatch
%global cargo_install_lib 0

Name:           hwatch
Version:        0.3.18
Release:        %autorelease
Summary:        Modern alternative to the watch command
License:        MIT

URL:            https://github.com/blacknon/hwatch
Source:         %{url}/archive/refs/tags/%{version}.tar.gz

Patch0:         precise-intervals.diff

BuildRequires:  cargo-rpm-macros >= 26

%global _description %{expand:
A modern alternative to the watch command, records the differences in
execution results and can check this differences at after.}

%description %{_description}

%package bash-completion
BuildArch:      noarch
Summary:        Bash completion files for %{name}
Provides:       %{name}-bash-completion = %{version}-%{release}

Requires:       bash-completion
Requires:       %{name} = %{version}-%{release}

%description bash-completion
This package installs Bash completion files for %{name}

%package fish-completion
BuildArch:      noarch
Summary:        Fish completion files for %{name}
Provides:       %{name}-fish-completion = %{version}-%{release}

Requires:       fish
Requires:       %{name} = %{version}-%{release}

%description fish-completion
This package installs Fish completion files for %{name}

%package zsh-completion
BuildArch:      noarch
Summary:        Zsh completion files for %{name}
Provides:       %{name}-zsh-completion = %{version}-%{release}

Requires:       zsh
Requires:       %{name} = %{version}-%{release}

%description zsh-completion
This package installs Zsh completion files for %{name}

%prep
%autosetup -n %{crate}-%{version} -p1
cargo vendor
%cargo_prep -v vendor

%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%{cargo_vendor_manifest}

%install
%cargo_install

install -Dpm644 man/hwatch.1 %{buildroot}%{_mandir}/man1/hwatch.1

install -Dpm644 completion/bash/hwatch-completion.bash %{buildroot}%{bash_completions_dir}/hwatch
install -Dpm644 completion/fish/hwatch.fish %{buildroot}%{fish_completions_dir}/hwatch.fish
install -Dpm644 completion/zsh/_hwatch %{buildroot}%{zsh_completions_dir}/_hwatch

%if %{with check}
%check
%cargo_test
%endif

%files
%license LICENSE
%license LICENSE.dependencies
%license cargo-vendor.txt
%doc README.md
%{_bindir}/hwatch
%{_mandir}/man1/hwatch.1*

%files bash-completion
%{bash_completions_dir}/hwatch

%files zsh-completion
%{zsh_completions_dir}/_hwatch

%files fish-completion
%{fish_completions_dir}/hwatch.fish

%changelog
%autochangelog