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

# Autogenerated by pycargoebuild 0.13.2

EAPI=8

CRATES="
	addr2line@0.21.0
	adler@1.0.2
	aes@0.8.4
	aho-corasick@1.1.2
	alloc-no-stdlib@2.0.4
	alloc-stdlib@0.2.2
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	anstream@0.6.12
	anstyle@1.0.6
	anstyle-parse@0.2.3
	anstyle-query@1.0.2
	anstyle-wincon@3.0.2
	anyhow@1.0.80
	async-compression@0.4.6
	autocfg@1.1.0
	backtrace@0.3.69
	base64@0.21.7
	base64ct@1.6.0
	bitflags@1.3.2
	bitflags@2.4.2
	block-buffer@0.10.4
	brotli@3.4.0
	brotli-decompressor@2.5.1
	bumpalo@3.15.3
	bytecount@0.6.7
	byteorder@1.5.0
	bytes@1.5.0
	bzip2@0.4.4
	bzip2-sys@0.1.11+1.0.8
	cc@1.0.88
	cfg-if@1.0.0
	chrono@0.4.34
	cipher@0.4.4
	clap@4.5.1
	clap_builder@4.5.1
	clap_complete@4.5.1
	clap_derive@4.5.0
	clap_lex@0.7.0
	colorchoice@1.0.0
	colored@2.1.0
	constant_time_eq@0.1.5
	core-foundation@0.9.4
	core-foundation-sys@0.8.6
	cpufeatures@0.2.12
	crc32fast@1.4.0
	crossbeam-deque@0.8.5
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.19
	crypto-common@0.1.6
	csv@1.3.0
	csv-core@0.1.11
	deranged@0.3.11
	diff@0.1.13
	digest@0.10.7
	dirs@5.0.1
	dirs-sys@0.4.1
	duct@0.13.7
	either@1.10.0
	embed-resource@1.8.0
	encoding_rs@0.8.33
	encoding_rs_io@0.1.7
	env_filter@0.1.0
	env_logger@0.10.2
	env_logger@0.11.2
	equivalent@1.0.1
	errno@0.3.8
	fastrand@2.0.1
	filetime@0.2.23
	flate2@1.0.28
	fnv@1.0.7
	form_urlencoded@1.2.1
	futures-channel@0.3.30
	futures-core@0.3.30
	futures-io@0.3.30
	futures-sink@0.3.30
	futures-task@0.3.30
	futures-util@0.3.30
	generic-array@0.14.7
	getrandom@0.2.12
	gimli@0.28.1
	h2@0.3.24
	hashbrown@0.14.3
	heck@0.4.1
	hermit-abi@0.3.8
	hmac@0.12.1
	http@0.2.11
	http-body@0.4.6
	httparse@1.8.0
	httpdate@1.0.3
	humantime@2.1.0
	hyper@0.14.28
	hyper-rustls@0.24.2
	iana-time-zone@0.1.60
	iana-time-zone-haiku@0.1.2
	idna@0.5.0
	indexmap@2.2.3
	indoc@2.0.4
	inout@0.1.3
	ipnet@2.9.0
	is-terminal@0.4.12
	itoa@1.0.10
	js-sys@0.3.68
	junction@1.0.0
	lazy_static@1.4.0
	libc@0.2.153
	libredox@0.0.1
	linux-raw-sys@0.4.13
	log@0.4.20
	lzma-sys@0.1.20
	memchr@2.7.1
	miette@5.10.0
	miette-derive@5.10.0
	mime@0.3.17
	minimal-lexical@0.2.1
	miniz_oxide@0.7.2
	mio@0.8.10
	node-semver@2.1.0
	nom@7.1.3
	ntapi@0.4.1
	num-conv@0.1.0
	num-traits@0.2.18
	num_cpus@1.16.0
	object@0.32.2
	once_cell@1.19.0
	openssl-probe@0.1.5
	option-ext@0.2.0
	os_pipe@1.1.5
	password-hash@0.4.2
	pbkdf2@0.11.0
	percent-encoding@2.3.1
	pin-project-lite@0.2.13
	pin-utils@0.1.0
	pkg-config@0.3.30
	powerfmt@0.2.0
	pretty_assertions@1.4.0
	proc-macro2@1.0.78
	quote@1.0.35
	rand_core@0.6.4
	rayon@1.8.1
	rayon-core@1.12.1
	redox_syscall@0.4.1
	redox_users@0.4.4
	regex@1.10.3
	regex-automata@0.4.5
	regex-syntax@0.8.2
	reqwest@0.11.24
	ring@0.17.8
	rustc-demangle@0.1.23
	rustc_version@0.4.0
	rustix@0.38.31
	rustls@0.21.10
	rustls-native-certs@0.6.3
	rustls-pemfile@1.0.4
	rustls-webpki@0.101.7
	ryu@1.0.17
	schannel@0.1.23
	scopeguard@1.2.0
	sct@0.7.1
	security-framework@2.9.2
	security-framework-sys@2.9.1
	semver@1.0.22
	serde@1.0.197
	serde_derive@1.0.197
	serde_json@1.0.114
	serde_urlencoded@0.7.1
	sha1@0.10.6
	sha2@0.10.8
	shared_child@1.0.0
	slab@0.4.9
	socket2@0.5.6
	spin@0.9.8
	strsim@0.11.0
	subtle@2.5.0
	syn@2.0.51
	sync_wrapper@0.1.2
	sysinfo@0.29.11
	system-configuration@0.5.1
	system-configuration-sys@0.5.0
	tar@0.4.40
	tempfile@3.10.1
	termcolor@1.4.1
	test-log@0.2.15
	test-log-macros@0.2.15
	thiserror@1.0.57
	thiserror-impl@1.0.57
	time@0.3.34
	time-core@0.1.2
	tinyvec@1.6.0
	tinyvec_macros@0.1.1
	tokio@1.36.0
	tokio-rustls@0.24.1
	tokio-util@0.7.10
	toml@0.5.11
	tower-service@0.3.2
	tracing@0.1.40
	tracing-core@0.1.32
	try-lock@0.2.5
	typenum@1.17.0
	unicode-bidi@0.3.15
	unicode-ident@1.0.12
	unicode-normalization@0.1.23
	unicode-width@0.1.11
	untrusted@0.9.0
	url@2.5.0
	utf8parse@0.2.1
	version_check@0.9.4
	vswhom@0.1.0
	vswhom-sys@0.1.2
	want@0.3.1
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen@0.2.91
	wasm-bindgen-backend@0.2.91
	wasm-bindgen-futures@0.4.41
	wasm-bindgen-macro@0.2.91
	wasm-bindgen-macro-support@0.2.91
	wasm-bindgen-shared@0.2.91
	web-sys@0.3.68
	webpki-roots@0.25.4
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.6
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows-core@0.52.0
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-targets@0.48.5
	windows-targets@0.52.3
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.3
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.3
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.3
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.3
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.3
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.3
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.3
	winreg@0.10.1
	winreg@0.50.0
	xattr@1.3.1
	xz2@0.1.7
	yansi@0.5.1
	zip@0.6.6
	zstd@0.11.2+zstd.1.5.2
	zstd-safe@5.0.2+zstd.1.5.2
	zstd-sys@2.0.9+zstd.1.5.5
"

inherit cargo shell-completion

DESCRIPTION="Fast and simple Node.js version manager"
HOMEPAGE="https://github.com/Schniz/fnm"
SRC_URI="
	https://github.com/Schniz/fnm/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"

LICENSE="GPL-3"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD CC0-1.0 ISC MIT MPL-2.0 openssl Unicode-DFS-2016"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"

PROPERTIES="test_network"
RESTRICT="!test? ( test )"

DEPEND="app-arch/xz-utils"
RDEPEND="${DEPEND}"
BDEPEND="
	test? (
		>=app-shells/bash-3.0:*
		app-shells/fish
		app-shells/zsh
	)
"

PATCHES=(
	"${FILESDIR}/${P}-remove-deprecated-time-dependency.patch"
	"${FILESDIR}/${P}-skip-windows-related-tests.patch"
	"${FILESDIR}/${P}-ring17.patch"
)

QA_FLAGS_IGNORED="usr/bin/${PN}"

src_install() {
	cargo_src_install

	"${D}"/usr/bin/fnm completions --shell bash > "${PN}" || die "Cannot generate bash completions"
	dobashcomp "${PN}"

	"${D}"/usr/bin/fnm completions --shell zsh > "_${PN}" || die "Cannot generate zsh completions"
	dozshcomp "_${PN}"

	"${D}"/usr/bin/fnm completions --shell fish > "${PN}.fish" || die "Cannot generate fish completions"
	dofishcomp "${PN}.fish"

	dodoc CHANGELOG.md README.md
}