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

EAPI=8

CRATES="
	aho-corasick@1.1.3
	anes@0.1.6
	anstyle@1.0.8
	approx@0.5.1
	assert_cmd@2.0.16
	atty@0.2.14
	autocfg@1.3.0
	bitflags@1.3.2
	bstr@1.10.0
	bumpalo@3.16.0
	byteorder@1.5.0
	cast@0.3.0
	cfg-if@1.0.0
	ciborium-io@0.2.2
	ciborium-ll@0.2.2
	ciborium@0.2.2
	clap@3.2.25
	clap@4.5.17
	clap_builder@4.5.17
	clap_complete@3.2.5
	clap_lex@0.2.4
	clap_lex@0.7.2
	criterion-plot@0.5.0
	criterion@0.5.1
	crossbeam-deque@0.8.5
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.20
	crunchy@0.2.2
	difflib@0.4.0
	doc-comment@0.3.3
	either@1.13.0
	errno@0.3.9
	getrandom@0.2.15
	half@2.4.1
	hashbrown@0.12.3
	hermit-abi@0.1.19
	hermit-abi@0.3.9
	hermit-abi@0.4.0
	indexmap@1.9.3
	io-lifetimes@1.0.11
	is-terminal@0.4.13
	itertools@0.10.5
	itoa@1.0.11
	js-sys@0.3.70
	libc@0.2.158
	linux-raw-sys@0.3.8
	log@0.4.22
	memchr@2.7.4
	minimal-lexical@0.2.1
	nom@7.1.3
	num-traits@0.2.19
	once_cell@1.19.0
	oorandom@11.1.4
	os_str_bytes@6.6.1
	output_vt100@0.1.3
	plotters-backend@0.3.6
	plotters-svg@0.3.6
	plotters@0.3.6
	ppv-lite86@0.2.20
	predicates-core@1.0.8
	predicates-tree@1.0.11
	predicates@3.1.2
	proc-macro2@1.0.86
	quote@1.0.37
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	rand_xoshiro@0.6.0
	rayon-core@1.12.1
	rayon@1.10.0
	regex-automata@0.4.7
	regex-syntax@0.8.4
	regex@1.10.6
	rustix@0.37.27
	ryu@1.0.18
	same-file@1.0.6
	serde@1.0.210
	serde_derive@1.0.210
	serde_json@1.0.128
	strsim@0.10.0
	syn@2.0.77
	termcolor@1.4.1
	terminal_size@0.2.6
	termtree@0.4.1
	textwrap@0.16.1
	tinytemplate@1.2.1
	unicode-ident@1.0.12
	wait-timeout@0.2.0
	walkdir@2.5.0
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.93
	wasm-bindgen-macro-support@0.2.93
	wasm-bindgen-macro@0.2.93
	wasm-bindgen-shared@0.2.93
	wasm-bindgen@0.2.93
	web-sys@0.3.70
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.9
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	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_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	zerocopy-derive@0.7.35
	zerocopy@0.7.35
"

inherit cargo

DESCRIPTION="A command-line tool to generate, analyze, convert and manipulate colors"
HOMEPAGE="https://github.com/sharkdp/pastel"

LICENSE="Apache-2.0 MIT"
# Dependent crate licenses
LICENSE+=" Apache-2.0 MIT Unicode-DFS-2016"
SLOT="0"
if [[ ${PV} == *9999* ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/sharkdp/${PN}.git"
else
	SRC_URI="
	https://github.com/sharkdp/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
	"
	KEYWORDS="~amd64"
fi

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