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

# Autogenerated by pycargoebuild 0.14.0

EAPI=8

inherit cargo optfeature shell-completion

DESCRIPTION="Easily and securely share files from the command line"
HOMEPAGE="https://timvisee.com/projects/ffsend/"

if [[ "${PV}" = "9999" ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/timvisee/ffsend.git"
else
	SRC_URI="
		https://github.com/timvisee/ffsend/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
		https://github.com/beatussum/gentoo-tarballs/releases/download/latest/${P}-crates.tar.xz
	"

	KEYWORDS="~amd64"
fi

LICENSE="GPL-3"

# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0 Unicode-DFS-2016"

SLOT="0"

DOCS=(
	res/
	CONTRIBUTING.md
	README.md
	SECURITY.md
)

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

src_install() {
	einstalldocs
	cargo_src_install

	newbashcomp contrib/completions/ffsend.bash ffsend
	dofishcomp contrib/completions/ffsend.fish
	dozshcomp contrib/completions/_ffsend

	exeinto /usr/share/nautilus-script
	doexe contrib/util/nautilus/firefox-send
}

pkg_postinst() {
	optfeature "the Nautilus script support" \
		"gnome-base/nautilus" \
		"gnome-extra/zenity"
}