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

EAPI=8

CRATES="
"

RUST_MIN_VER="1.89.0"
inherit cargo shell-completion

DESCRIPTION="Real-time co-editing of local text files"
HOMEPAGE="https://teamtype.github.io/teamtype/"
SRC_URI="https://github.com/teamtype/teamtype/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" https://raw.githubusercontent.com/PPN-SD/vendor/refs/tags/${P}/${P}-crates.tar.xz"
S="${WORKDIR}/${P}/crates/${PN}"

LICENSE="AGPL-3+"
# ring licenses
LICENSE+=" openssl"
# Autogenerated by pycargoebuild
# Dependent crate licenses
LICENSE+="
	Apache-2.0 BSD CC0-1.0 CDLA-Permissive-2.0 EUPL-1.2 GPL-3 ISC LGPL-3
	MIT MPL-2.0 Unicode-3.0 Unlicense ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

QA_FLAGS_IGNORED="usr/bin/teamtype"

DEPEND="dev-libs/libgit2:="
RDEPEND="${DEPEND}"

src_install() {
	cargo_src_install

	pushd "${WORKDIR}"/${P} >/dev/null || die
	dodoc CHANGELOG.md README.md
	doman target/manpages/*.1

	newbashcomp target/completions/${PN}.bash ${PN}
	dofishcomp target/completions/${PN}.fish
	dozshcomp target/completions/_${PN}
	popd >/dev/null || die
}