File codeberg-cli.spec of Package codeberg-cli
#
# spec file for package codeberg-cli
#
# 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/
#
Name: codeberg-cli
Version: 0.4.11
Release: 0
Summary: CLI for Codeberg
License: AGPL-3.0-only
URL: https://codeberg.org/RobWalt/codeberg-cli
Source0: https://codeberg.org/RobWalt/codeberg-cli/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: vendor.tar.xz
BuildRequires: cargo-packaging
BuildRequires: rust+cargo
BuildRequires: pkgconfig(openssl)
Recommends: git
%description
Codeberg CLI provides the `berg` command for managing Codeberg repositories. It provides similar
functionality as those from GitHub CLI and GitLab CLI
%package bash-completion
Summary: Bash completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Supplements: (%{name} and bash)
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} = %{version}
Supplements: (%{name} and fish)
BuildArch: noarch
%description fish-completion
Fish command line completion support for %{name}
%package zsh-completion
Summary: Zsh completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Supplements: (%{name} and zsh)
BuildArch: noarch
%description zsh-completion
Zsh command line completion support for %{name}
%prep
%autosetup -a1 -n %{name}
%build
%{cargo_build}
# generate completion files
cargo run completion bash > %{name}.bash
cargo run completion zsh > %{name}.zsh
cargo run completion fish > %{name}.fish
%install
%{cargo_install}
# install completion files
install -D -m0644 %{name}.bash %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -D -m0644 %{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish
install -D -m0644 %{name}.zsh %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
ln -s %{_datadir}/bash-completion/completions/%{name} %{buildroot}%{_datadir}/bash-completion/completions/berg
ln -s %{_datadir}/fish/vendor_completions.d/%{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/berg.fish
ln -s %{_datadir}/zsh/site-functions/_%{name} %{buildroot}%{_datadir}/zsh/site-functions/_berg
%files
%defattr(-,root,root,-)
%doc README.md CONTRIBUTING.md CHANGELOG.md
%license LICENSE
%{_bindir}/berg
%files bash-completion
%dir %{_datadir}/bash-completion
%{_datadir}/bash-completion/completions
%files fish-completion
%dir %{_datadir}/fish/
%{_datadir}/fish/vendor_completions.d/
%files zsh-completion
%dir %{_datadir}/zsh
%{_datadir}/zsh/site-functions/
%changelog