File dirp.spec of Package dirp

#
# spec file for package dirp
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2021-2025 Avindra Goolcharan <avindra@opensuse.org>
#
# 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         provider_prefix github.com/avindra/dirp
%global         import_path     %{provider_prefix}
Name:           dirp
Version:        0.7.1
Release:        0
Summary:        A program to manage directories
License:        MIT
URL:            https://github.com/avindra/dirp
Source0:        https://github.com/avindra/dirp/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires:  golang(API) >= 1.16
BuildRequires:  golang-packaging
Requires:       fzf

%package        bash-completion
Summary:        Bash Completion for %{name}
Group:          System/Shells
Requires:       %{name}
Requires:       bash-completion
Supplements:    (%{name} and bash-completion)
BuildArch:      noarch

%description    bash-completion
Bash command-line completion support for %{name}.

%package        fish-completion
Summary:        Fish Completion for %{name}
Group:          System/Shells
Requires:       %{name}
Requires:       fish
Supplements:    (%{name} and fish)
BuildArch:      noarch

%description    fish-completion
Fish command-line completion support for %{name}.

%description
A directory bookmark manager and driller.

%prep
%autosetup
%{goprep} %{import_path}

%build
%{gobuild}

%install
%{goinstall}

export PATH="%{buildroot}%{_bindir}:${PATH}"
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/
mkdir -p %{buildroot}%{_datadir}/fish/vendor_completions.d

dirp hook > %{buildroot}%{_datadir}/bash-completion/completions/%{name}.sh
dirp hook fish > %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish

%check
%{gotest} ./...

%files
%license COPYING
%doc README.md
%{_bindir}/%{name}

%files fish-completion
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%{_datadir}/fish/vendor_completions.d/%{name}.fish

%files bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/%{name}.sh

%changelog
openSUSE Build Service is sponsored by