# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.15.0

EAPI=8

RUST_MIN_VER="1.88.0"

CRATES=" "

inherit cargo shell-completion

DESCRIPTION="A beautiful and configurable TUI client for MPD"
HOMEPAGE="https://mierak.github.io/rmpc/"
LICENSE="BSD"

# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD CC0-1.0 ISC
	LGPL-3+ MIT UoI-NCSA Unicode-3.0 ZLIB
"

if [[ "${PV}" == *9999* ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/mierak/${PN}"
else
	SRC_URI="https://github.com/mierak/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
		${CARGO_CRATE_URIS}"
	KEYWORDS="~amd64"
	RESTRICT="mirror"
fi

SLOT="0"

DOCS=( README.md CHANGELOG.md )

src_unpack() {
	if [[ "$PV" == *9999* ]];then
		git-r3_src_unpack
		cargo_live_src_unpack
	else
		cargo_src_unpack
	fi
}

src_install() {
	cargo_src_install
	einstalldocs
	doman target/man/*
	newbashcomp target/completions/rmpc.bash rmpc
	dozshcomp target/completions/_rmpc
	dofishcomp target/completions/rmpc.fish
}