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

# Autogenerated by pycargoebuild 0.15.0

EAPI=8

CRATES="
	addr2line@0.24.2
	adler2@2.0.0
	aho-corasick@1.1.3
	allocator-api2@0.2.21
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	anstream@0.6.18
	anstyle-parse@0.2.6
	anstyle-query@1.1.2
	anstyle-wincon@3.0.8
	anstyle@1.0.10
	anyhow@1.0.98
	async-trait@0.1.88
	autocfg@1.4.0
	backtrace@0.3.75
	better-panic@0.3.0
	bitflags@1.3.2
	bitflags@2.9.1
	block-buffer@0.10.4
	block@0.1.6
	build-rs@0.1.2
	bumpalo@3.17.0
	bytemuck@1.23.0
	byteorder-lite@0.1.0
	byteorder@1.5.0
	bytes@1.10.1
	cassowary@0.3.0
	castaway@0.2.3
	cc@1.2.24
	cfg-expr@0.15.8
	cfg-if@1.0.0
	chrono@0.4.41
	clap@4.5.38
	clap_builder@4.5.38
	clap_complete@4.5.50
	clap_derive@4.5.32
	clap_lex@0.7.4
	clipboard-win@3.1.1
	colorchoice@1.0.3
	colorsys@0.6.7
	compact_str@0.8.1
	console@0.15.11
	conv@0.3.3
	convert_case@0.7.1
	copypasta-ext@0.4.4
	copypasta@0.8.2
	core-foundation-sys@0.8.7
	cpufeatures@0.2.17
	crc32fast@1.4.2
	crossterm@0.28.1
	crossterm@0.29.0
	crossterm_winapi@0.9.1
	crypto-common@0.1.6
	cstr-argument@0.1.2
	custom_derive@0.1.7
	darling@0.20.11
	darling_core@0.20.11
	darling_macro@0.20.11
	derive_more-impl@2.0.1
	derive_more@2.0.1
	diff@0.1.13
	digest@0.10.7
	dirs-next@2.0.0
	dirs-sys-next@0.1.2
	dirs-sys@0.5.0
	dirs@6.0.0
	dlib@0.5.2
	document-features@0.2.11
	downcast-rs@1.2.1
	either@1.15.0
	encode_unicode@1.0.0
	env_filter@0.1.3
	env_logger@0.11.8
	equivalent@1.0.2
	errno@0.3.12
	fdeflate@0.3.7
	flate2@1.1.1
	fnv@1.0.7
	foldhash@0.1.5
	fxhash@0.2.1
	generic-array@0.14.7
	gethostname@0.2.3
	getrandom@0.2.16
	gimli@0.31.1
	gpg-error@0.6.2
	gpgme-sys@0.11.0
	gpgme@0.11.0
	hashbrown@0.15.3
	heck@0.5.0
	hex@0.4.3
	home@0.5.11
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.63
	ident_case@1.0.1
	image@0.25.6
	indexmap@2.9.0
	indoc@2.0.6
	instability@0.3.7
	is_terminal_polyfill@1.70.1
	itertools@0.13.0
	itoa@1.0.15
	jiff-static@0.2.14
	jiff@0.2.14
	js-sys@0.3.77
	lazy-bytes-cast@5.0.1
	lazy_static@1.5.0
	libc@0.2.172
	libgpg-error-sys@0.6.2
	libloading@0.8.7
	libredox@0.1.3
	linux-raw-sys@0.4.15
	linux-raw-sys@0.9.4
	litrs@0.4.1
	lock_api@0.4.12
	log@0.4.27
	lru@0.12.5
	malloc_buf@0.0.6
	memchr@2.7.4
	memmap2@0.5.10
	memoffset@0.6.5
	memoffset@0.7.1
	miniz_oxide@0.8.8
	mio@1.0.3
	nix@0.24.3
	num-traits@0.2.19
	objc-foundation@0.1.1
	objc@0.2.7
	objc_id@0.1.1
	object@0.36.7
	once_cell@1.21.3
	once_cell_polyfill@1.70.1
	option-ext@0.2.0
	parking_lot@0.12.3
	parking_lot_core@0.9.10
	paste@1.0.15
	pkg-config@0.3.32
	png@0.17.16
	portable-atomic-util@0.2.4
	portable-atomic@1.11.0
	pretty_assertions@1.4.1
	proc-macro2@1.0.95
	quote@1.0.40
	ratatui-splash-screen@0.1.4
	ratatui@0.29.0
	redox_syscall@0.5.12
	redox_users@0.4.6
	redox_users@0.5.0
	regex-automata@0.4.9
	regex-syntax@0.8.5
	regex@1.11.1
	rustc-demangle@0.1.24
	rustix@0.38.44
	rustix@1.0.7
	rustversion@1.0.21
	ryu@1.0.20
	scoped-tls@1.0.1
	scopeguard@1.2.0
	serde@1.0.219
	serde_derive@1.0.219
	serde_json@1.0.140
	serde_spanned@0.6.8
	sha256@1.6.0
	sha2@0.10.9
	shellexpand@3.1.1
	shlex@1.3.0
	signal-hook-mio@0.2.4
	signal-hook-registry@1.4.5
	signal-hook@0.3.18
	simd-adler32@0.3.7
	smallvec@1.15.0
	smithay-client-toolkit@0.16.1
	smithay-clipboard@0.6.6
	static_assertions@1.1.0
	strsim@0.11.1
	strum@0.26.3
	strum_macros@0.26.4
	syn@2.0.101
	system-deps@6.2.2
	target-lexicon@0.12.16
	terminal_size@0.4.2
	thiserror-impl@1.0.69
	thiserror-impl@2.0.12
	thiserror@1.0.69
	thiserror@2.0.12
	tinytemplate@1.2.1
	toml@0.8.22
	toml_datetime@0.6.9
	toml_edit@0.22.26
	toml_write@0.1.1
	tui-logger@0.17.2
	typenum@1.18.0
	unicode-ident@1.0.18
	unicode-segmentation@1.12.0
	unicode-truncate@1.1.0
	unicode-width@0.1.14
	unicode-width@0.2.0
	utf8parse@0.2.2
	version-compare@0.2.0
	version_check@0.9.5
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.100
	wasm-bindgen-macro-support@0.2.100
	wasm-bindgen-macro@0.2.100
	wasm-bindgen-shared@0.2.100
	wasm-bindgen@0.2.100
	wayland-client@0.29.5
	wayland-commons@0.29.5
	wayland-cursor@0.29.5
	wayland-protocols@0.29.5
	wayland-scanner@0.29.5
	wayland-sys@0.29.5
	which@4.4.2
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-wsapoll@0.1.2
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-core@0.61.2
	windows-implement@0.60.0
	windows-interface@0.59.1
	windows-link@0.1.1
	windows-result@0.3.4
	windows-strings@0.4.2
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-targets@0.48.5
	windows-targets@0.52.6
	windows-targets@0.53.0
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_gnullvm@0.53.0
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_aarch64_msvc@0.53.0
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnu@0.53.0
	windows_i686_gnullvm@0.52.6
	windows_i686_gnullvm@0.53.0
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_i686_msvc@0.53.0
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnu@0.53.0
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_gnullvm@0.53.0
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	windows_x86_64_msvc@0.53.0
	winnow@0.7.10
	winreg@0.10.1
	winreg@0.52.0
	x11-clipboard@0.7.1
	x11rb-protocol@0.10.0
	x11rb@0.10.1
	xcursor@0.3.8
	xml-rs@0.8.26
	yansi@1.0.1
	zune-core@0.4.12
	zune-jpeg@0.4.14
	${PN}@${PV}
"

inherit cargo shell-completion

DESCRIPTION="Terminal User Interface for GnuPG"
HOMEPAGE="
	https://crates.io/crates/gpg-tui
	https://github.com/orhun/gpg-tui
"
SRC_URI="
	${CARGO_CRATE_URIS}
	https://github.com/orhun/${PN}/raw/v${PV}/man/${PN}.1 -> ${P}.man.1
	https://github.com/orhun/${PN}/raw/v${PV}/man/${PN}.toml.5 -> ${P}.toml.man.5
"

LICENSE="MIT"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions Boost-1.0 ISC LGPL-2.1
	MIT MPL-2.0 Unicode-3.0 Unlicense ZLIB
"
SLOT="0"
KEYWORDS="amd64"

DEPEND="
	app-crypt/gpgme
	dev-libs/libgpg-error
	x11-libs/libxcb
"
RDEPEND="${DEPEND}"
BDEPEND="x11-libs/libxkbcommon"

src_unpack() {
	cargo_src_unpack

	local man="${T}/man"
	mkdir -- "${man}" || die
	cp -v -- "${DISTDIR}/${P}.man.1" "${man}/${PN}.1" || die
	cp -v -- "${DISTDIR}/${P}.toml.man.5" "${man}/${PN}.toml.5" || die
}

src_install() {
	cargo_src_install

	doman "${T}/man"/*

	local exe="${ED}/usr/bin/${PN}-completions"
	local completions="${S}/completions"
	mkdir -p "${completions}" || die
	ebegin "generating completions"
	OUT_DIR="${completions}" "${exe}"
	eend "${?}" 'failed to generate completions' || die "${_}"
	rm "${exe}" || die

	# bash-completion
	newbashcomp "completions/${PN}.bash" "${PN}"

	# zsh-completion
	dozshcomp "completions/_${PN}"

	# fish-completion
	dofishcomp "completions/${PN}.fish"
}

# rust does not use *FLAGS from make.conf, silence portage warning
# update with proper path to binaries this crate installs, omit leading /
QA_FLAGS_IGNORED="usr/bin/${PN}"