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

EAPI=8

CRATES="
	addr2line@0.24.2
	adler2@2.0.0
	ahash@0.7.8
	ahash@0.8.11
	aho-corasick@1.1.3
	allocator-api2@0.2.21
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	anes@0.1.6
	anstream@0.6.18
	anstyle-parse@0.2.6
	anstyle-query@1.1.2
	anstyle-wincon@3.0.6
	anstyle@1.0.10
	anyhow@1.0.95
	arbitrary@1.4.1
	arc-swap@1.7.1
	arrayvec@0.7.6
	askalono@0.5.0
	autocfg@1.4.0
	backtrace@0.3.74
	base64@0.22.1
	bitflags@1.3.2
	bitflags@2.6.0
	bitvec@1.0.1
	block-buffer@0.10.4
	borsh-derive@1.5.3
	borsh@1.5.3
	bstr@1.11.1
	bumpalo@3.16.0
	byte-unit@5.1.6
	bytecheck@0.6.12
	bytecheck_derive@0.6.12
	bytemuck@1.21.0
	byteorder-lite@0.1.0
	byteorder@1.5.0
	bytes@1.9.0
	cargo_toml@0.21.0
	cast@0.3.0
	cc@1.2.6
	cfg-if@1.0.0
	cfg_aliases@0.2.1
	chrono-tz-build@0.3.0
	chrono-tz@0.9.0
	chrono@0.4.39
	ciborium-io@0.2.2
	ciborium-ll@0.2.2
	ciborium@0.2.2
	clap@4.5.23
	clap_builder@4.5.23
	clap_complete@4.5.40
	clap_derive@4.5.18
	clap_lex@0.7.4
	clru@0.6.2
	cmake@0.1.52
	color_quant@1.1.0
	colorchoice@1.0.3
	colored@2.2.0
	console@0.15.10
	core-foundation-sys@0.8.7
	cpufeatures@0.2.16
	crc-catalog@2.4.0
	crc32fast@1.4.2
	crc@3.2.1
	criterion-plot@0.5.0
	criterion@0.5.1
	crossbeam-channel@0.5.14
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.21
	crunchy@0.2.2
	crypto-common@0.1.6
	dashmap@6.1.0
	deranged@0.3.11
	derive_arbitrary@1.4.1
	deunicode@1.6.0
	digest@0.10.7
	displaydoc@0.2.5
	dunce@1.0.5
	either@1.13.0
	enable-ansi-support@0.2.1
	encode_unicode@1.0.0
	encoding_rs@0.8.35
	encoding_rs_io@0.1.7
	env_filter@0.1.3
	env_logger@0.11.6
	equivalent@1.0.1
	erased-serde@0.4.5
	errno@0.3.10
	etcetera@0.8.0
	faster-hex@0.9.0
	fastrand@2.3.0
	fdeflate@0.3.7
	filetime@0.2.25
	flate2@1.0.35
	fnv@1.0.7
	form_urlencoded@1.2.1
	fs_extra@1.3.0
	funty@2.0.0
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-executor@0.3.31
	futures-io@0.3.31
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-timer@3.0.3
	futures-util@0.3.31
	futures@0.3.31
	generic-array@0.14.7
	getrandom@0.2.15
	gimli@0.31.1
	gix-actor@0.31.5
	gix-actor@0.33.1
	gix-attributes@0.22.5
	gix-attributes@0.23.1
	gix-bitmap@0.2.13
	gix-chunk@0.4.10
	gix-command@0.4.0
	gix-commitgraph@0.24.3
	gix-commitgraph@0.25.1
	gix-config-value@0.14.10
	gix-config@0.42.0
	gix-date@0.8.7
	gix-date@0.9.3
	gix-diff@0.49.0
	gix-dir@0.11.0
	gix-discover@0.32.0
	gix-discover@0.37.0
	gix-features@0.38.2
	gix-features@0.39.1
	gix-filter@0.16.0
	gix-fs@0.11.3
	gix-fs@0.12.1
	gix-glob@0.16.5
	gix-glob@0.17.1
	gix-hash@0.14.2
	gix-hash@0.15.1
	gix-hashtable@0.5.2
	gix-hashtable@0.6.0
	gix-ignore@0.11.4
	gix-ignore@0.12.1
	gix-index@0.33.1
	gix-index@0.37.0
	gix-lock@14.0.0
	gix-lock@15.0.1
	gix-mailmap@0.25.1
	gix-object@0.42.3
	gix-object@0.46.1
	gix-odb@0.66.0
	gix-pack@0.56.0
	gix-packetline-blocking@0.18.1
	gix-packetline@0.18.2
	gix-path@0.10.13
	gix-pathspec@0.8.1
	gix-protocol@0.47.0
	gix-quote@0.4.14
	gix-ref@0.44.1
	gix-ref@0.49.1
	gix-refspec@0.27.0
	gix-revision@0.31.1
	gix-revwalk@0.13.2
	gix-revwalk@0.17.0
	gix-sec@0.10.10
	gix-shallow@0.1.0
	gix-status@0.16.0
	gix-submodule@0.16.0
	gix-tempfile@14.0.2
	gix-tempfile@15.0.0
	gix-testtools@0.15.0
	gix-trace@0.1.11
	gix-transport@0.44.0
	gix-traverse@0.39.2
	gix-traverse@0.43.1
	gix-url@0.28.2
	gix-utils@0.1.13
	gix-validate@0.8.5
	gix-validate@0.9.2
	gix-worktree@0.34.1
	gix-worktree@0.38.0
	gix@0.69.1
	glob@0.3.2
	globset@0.4.15
	globwalk@0.9.1
	grep-matcher@0.1.7
	grep-searcher@0.1.14
	half@2.4.1
	hashbrown@0.12.3
	hashbrown@0.14.5
	hashbrown@0.15.2
	heck@0.5.0
	hermit-abi@0.4.0
	home@0.5.11
	human-panic@2.0.2
	humansize@2.1.3
	humantime@2.1.0
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.61
	icu_collections@1.5.0
	icu_locid@1.5.0
	icu_locid_transform@1.5.0
	icu_locid_transform_data@1.5.0
	icu_normalizer@1.5.0
	icu_normalizer_data@1.5.0
	icu_properties@1.5.1
	icu_properties_data@1.5.0
	icu_provider@1.5.0
	icu_provider_macros@1.5.0
	idna@1.0.3
	idna_adapter@1.2.0
	ignore@0.4.23
	image-webp@0.2.0
	image@0.25.5
	imara-diff@0.1.7
	indexmap@2.7.0
	insta@1.41.1
	inventory@0.3.16
	io-close@0.3.7
	is-terminal@0.4.13
	is_ci@1.2.0
	is_terminal_polyfill@1.70.1
	itertools@0.10.5
	itertools@0.11.0
	itoa@1.0.14
	jiff-tzdb-platform@0.1.1
	jiff-tzdb@0.1.1
	jiff@0.1.16
	jobserver@0.1.32
	js-sys@0.3.76
	json5@0.4.1
	kstring@2.0.2
	lazy_static@1.5.0
	libc@0.2.169
	libm@0.2.11
	libredox@0.1.3
	libz-ng-sys@1.1.20
	linked-hash-map@0.5.6
	linux-raw-sys@0.4.14
	litemap@0.7.4
	lock_api@0.4.12
	log@0.4.22
	maybe-async@0.2.10
	memchr@2.7.4
	memmap2@0.9.5
	miniz_oxide@0.8.2
	npm-package-json@0.1.3
	num-conv@0.1.0
	num-format@0.4.4
	num-traits@0.2.19
	num_threads@0.1.7
	object@0.36.7
	once_cell@1.20.2
	oorandom@11.1.4
	os_info@3.9.1
	owo-colors@4.1.0
	parking_lot@0.12.3
	parking_lot_core@0.9.10
	parse-zoneinfo@0.3.1
	paste@1.0.15
	percent-encoding@2.3.1
	pest@2.7.15
	pest_derive@2.7.15
	pest_generator@2.7.15
	pest_meta@2.7.15
	phf@0.11.2
	phf_codegen@0.11.2
	phf_generator@0.11.2
	phf_shared@0.11.2
	pin-project-lite@0.2.15
	pin-utils@0.1.0
	pkg-config@0.3.31
	plotters-backend@0.3.7
	plotters-svg@0.3.7
	plotters@0.3.7
	png@0.17.16
	portable-atomic@1.10.0
	powerfmt@0.2.0
	ppv-lite86@0.2.20
	proc-macro-crate@3.2.0
	proc-macro2@1.0.92
	prodash@28.0.0
	prodash@29.0.0
	ptr_meta@0.1.4
	ptr_meta_derive@0.1.4
	quick-error@2.0.1
	quote@1.0.38
	radium@0.7.0
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	rayon-core@1.12.1
	rayon@1.10.0
	redox_syscall@0.5.8
	regex-automata@0.4.9
	regex-syntax@0.8.5
	regex@1.11.1
	relative-path@1.9.3
	rend@0.4.2
	rkyv@0.7.45
	rkyv_derive@0.7.45
	rmp-serde@1.3.0
	rmp@0.8.14
	rstest@0.23.0
	rstest_macros@0.23.0
	rust_decimal@1.36.0
	rustc-demangle@0.1.24
	rustc_version@0.4.1
	rustix@0.38.42
	rustversion@1.0.19
	ryu@1.0.18
	same-file@1.0.6
	scopeguard@1.2.0
	seahash@4.1.0
	semver@1.0.24
	serde@1.0.217
	serde_derive@1.0.217
	serde_json@1.0.134
	serde_spanned@0.6.8
	serde_yaml@0.9.34+deprecated
	sha1_smol@1.0.1
	sha2@0.10.8
	shell-words@1.1.0
	shlex@1.3.0
	signal-hook-registry@1.4.2
	signal-hook@0.3.17
	simd-adler32@0.3.7
	simdutf8@0.1.5
	similar@2.6.0
	siphasher@0.3.11
	slab@0.4.9
	slug@0.1.6
	smallvec@1.13.2
	stable_deref_trait@1.2.0
	static_assertions@1.1.0
	strsim@0.11.1
	strum@0.26.3
	strum_macros@0.26.4
	syn@1.0.109
	syn@2.0.93
	synstructure@0.13.1
	table_formatter@0.6.1
	tap@1.0.1
	tar@0.4.43
	tempfile@3.14.0
	tera@1.20.0
	term_size@0.3.2
	terminal_size@0.4.1
	thiserror-impl@1.0.69
	thiserror-impl@2.0.9
	thiserror@1.0.69
	thiserror@2.0.9
	time-core@0.1.2
	time-humanize@0.1.3
	time-macros@0.2.19
	time@0.3.37
	tinystr@0.7.6
	tinytemplate@1.2.1
	tinyvec@1.8.1
	tinyvec_macros@0.1.1
	tokei@13.0.0-alpha.7
	toml@0.5.11
	toml@0.8.19
	toml_datetime@0.6.8
	toml_edit@0.22.22
	typeid@1.0.2
	typenum@1.17.0
	typetag-impl@0.2.19
	typetag@0.2.19
	ucd-trie@0.1.7
	uluru@3.1.0
	unic-char-property@0.9.0
	unic-char-range@0.9.0
	unic-common@0.9.0
	unic-segment@0.9.0
	unic-ucd-segment@0.9.0
	unic-ucd-version@0.9.0
	unicode-bom@2.0.3
	unicode-ident@1.0.14
	unicode-normalization@0.1.24
	unsafe-libyaml@0.2.11
	url@2.5.4
	utf16_iter@1.0.5
	utf8-width@0.1.7
	utf8_iter@1.0.4
	utf8parse@0.2.2
	uuid@1.11.0
	version_check@0.9.5
	walkdir@2.5.0
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.99
	wasm-bindgen-macro-support@0.2.99
	wasm-bindgen-macro@0.2.99
	wasm-bindgen-shared@0.2.99
	wasm-bindgen@0.2.99
	web-sys@0.3.76
	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-core@0.52.0
	windows-sys@0.42.0
	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.42.2
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.42.2
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.42.2
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.42.2
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.42.2
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.42.2
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.42.2
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	winnow@0.6.20
	winres@0.1.12
	write16@1.0.0
	writeable@0.5.5
	wyz@0.5.1
	yoke-derive@0.7.5
	yoke@0.7.5
	zerocopy-derive@0.7.35
	zerocopy@0.7.35
	zerofrom-derive@0.1.5
	zerofrom@0.1.5
	zerovec-derive@0.10.3
	zerovec@0.10.4
	zstd-safe@7.2.1
	zstd-sys@2.0.13+zstd.1.5.6
	zstd@0.13.2
	zune-core@0.4.12
	zune-jpeg@0.4.14
"

RUST_MIN_VER="1.81.0"

inherit cargo shell-completion

DESCRIPTION="Command-line Git information tool"
HOMEPAGE="https://onefetch.dev"
SRC_URI="https://github.com/o2sh/onefetch/archive/refs/tags/${PV}.tar.gz -> ${P}.gh.tar.gz
	https://git.sr.ht/~antecrescent/gentoo-files/blob/main/app-misc/onefetch/${P}-shellcomp.tar.xz
	${CARGO_CRATE_URIS}
"
LICENSE="MIT"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD ISC MPL-2.0 Unicode-3.0"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="app-arch/zstd:="
DEPEND="${RDEPEND}"
BDEPEND="
	dev-build/cmake
	virtual/pkgconfig
	test? (
		dev-vcs/git
		${RDEPEND}
	)
"

QA_FLAGS_IGNORED="usr/bin/onefetch"

pkg_setup() {
	export ZSTD_SYS_USE_PKG_CONFIG=1
	rust_pkg_setup
}

src_install() {
	doman docs/onefetch.1
	dodoc {CHANGELOG,README}.md

	dobashcomp "${WORKDIR}"/completions/onefetch
	dofishcomp "${WORKDIR}"/completions/onefetch.fish
	dozshcomp "${WORKDIR}"/completions/_onefetch
	cargo_src_install
}

pkg_postinst() {
	elog "Onefetch supports displaying images using x11-terms/kitty or any terminal emulator"
	elog "which supports the SIXEL graphics format or iTerm2's Inline Images Protocol."
	elog "See also: https://github.com/o2sh/onefetch/wiki/images-in-the-terminal"
}