# Copyright 2023-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.16.0

EAPI=8

CRATES="
	ahash@0.8.12
	aho-corasick@1.1.4
	anstream@0.6.21
	anstyle@1.0.13
	anstyle-parse@0.2.7
	anstyle-query@1.1.5
	anstyle-wincon@3.0.11
	anyhow@1.0.101
	async-priority-channel@0.2.0
	atomic-take@1.1.0
	autocfg@1.5.0
	bitflags@1.3.2
	bitflags@2.10.0
	block-buffer@0.10.4
	bstr@1.12.1
	bumpalo@3.19.1
	byteorder@1.5.0
	bytes@1.11.1
	cfg-if@1.0.4
	cfg_aliases@0.2.1
	clap@4.5.57
	clap_builder@4.5.57
	clap_complete@4.5.65
	clap_derive@4.5.55
	clap_lex@0.7.7
	colorchoice@1.0.4
	concurrent-queue@2.5.0
	const-random@0.1.18
	const-random-macro@0.1.16
	convert_case@0.10.0
	cpufeatures@0.2.17
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.21
	crossterm@0.29.0
	crossterm_winapi@0.9.1
	cruet@0.14.0
	crunchy@0.2.4
	crypto-common@0.1.7
	darling@0.20.11
	darling_core@0.20.11
	darling_macro@0.20.11
	deranged@0.5.5
	derive_builder@0.20.2
	derive_builder_core@0.20.2
	derive_builder_macro@0.20.2
	derive_more@2.1.1
	derive_more-impl@2.1.1
	deunicode@1.6.2
	diff@0.1.13
	digest@0.10.7
	dirs@4.0.0
	dirs-sys@0.3.7
	document-features@0.2.12
	downcast@0.11.0
	dunce@1.0.5
	endian-type@0.2.0
	enquote@1.1.0
	equivalent@1.0.2
	errno@0.3.14
	evalexpr@13.1.0
	event-listener@4.0.3
	faster-hex@0.10.0
	fastrand@2.3.0
	fnv@1.0.7
	fragile@2.0.1
	fsevent-sys@4.1.0
	futures@0.3.31
	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-util@0.3.31
	generic-array@0.14.7
	getrandom@0.2.17
	getrandom@0.3.4
	gix-actor@0.37.1
	gix-config@0.50.0
	gix-config-value@0.16.0
	gix-date@0.12.1
	gix-features@0.45.2
	gix-fs@0.18.2
	gix-glob@0.23.0
	gix-hash@0.21.2
	gix-hashtable@0.11.0
	gix-lock@20.0.1
	gix-object@0.54.1
	gix-path@0.10.22
	gix-ref@0.57.0
	gix-sec@0.12.2
	gix-tempfile@20.0.1
	gix-trace@0.1.17
	gix-utils@0.3.1
	gix-validate@0.10.1
	globset@0.4.18
	handlebars@6.4.0
	handlebars_misc_helpers@0.17.0
	hash32@0.3.1
	hashbrown@0.16.1
	heapless@0.8.0
	heck@0.5.0
	hostname@0.3.1
	ident_case@1.0.1
	ignore@0.4.25
	ignore-files@3.0.5
	indexmap@2.13.0
	inotify@0.11.0
	inotify-sys@0.1.5
	is_terminal_polyfill@1.70.2
	itoa@1.0.17
	jiff@0.2.19
	jiff-static@0.2.19
	jiff-tzdb@0.1.5
	jiff-tzdb-platform@0.1.3
	jmespath@0.3.0
	js-sys@0.3.85
	kqueue@1.1.1
	kqueue-sys@1.0.4
	lazy_static@1.5.0
	libc@0.2.180
	libredox@0.1.12
	linux-raw-sys@0.11.0
	litrs@1.0.0
	lock_api@0.4.14
	log@0.4.29
	maplit@1.0.2
	match_cfg@0.1.0
	memchr@2.8.0
	memmap2@0.9.9
	miette@7.6.0
	miette-derive@7.6.0
	mio@1.1.1
	mockall@0.12.1
	mockall_derive@0.12.1
	nibble_vec@0.1.0
	nix@0.30.1
	no-std-compat@0.4.1
	normalize-path@0.2.1
	notify@8.2.0
	notify-types@2.1.0
	num-conv@0.2.0
	num-modular@0.6.1
	num-order@1.2.0
	num-traits@0.2.19
	num_threads@0.1.7
	once_cell@1.21.3
	once_cell_polyfill@1.70.2
	parking@2.2.1
	parking_lot@0.12.5
	parking_lot_core@0.9.12
	pest@2.8.6
	pest_derive@2.8.6
	pest_generator@2.8.6
	pest_meta@2.8.6
	pin-project-lite@0.2.16
	pin-utils@0.1.0
	portable-atomic@1.13.1
	portable-atomic-util@0.2.5
	powerfmt@0.2.0
	predicates@3.1.3
	predicates-core@1.0.9
	predicates-tree@1.0.12
	proc-macro2@1.0.106
	process-wrap@9.0.1
	prodash@30.0.1
	project-origins@1.4.2
	quote@1.0.44
	r-efi@5.3.0
	radix_trie@0.3.0
	redox_syscall@0.5.18
	redox_users@0.4.6
	regex@1.12.3
	regex-automata@0.4.14
	regex-syntax@0.8.9
	rhai@1.24.0
	rhai_codegen@3.1.0
	rustc_version@0.4.1
	rustix@1.1.3
	rustversion@1.0.22
	ryu@1.0.22
	same-file@1.0.6
	scopeguard@1.2.0
	semver@1.0.27
	serde@1.0.228
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_json@1.0.149
	serde_spanned@0.6.9
	serde_spanned@1.1.1
	serde_yaml@0.9.34+deprecated
	sha1@0.10.6
	sha1-checked@0.10.0
	sha2@0.10.9
	shellexpand@2.1.2
	signal-hook@0.3.18
	signal-hook-mio@0.2.5
	signal-hook-registry@1.4.8
	simplelog@0.12.2
	slab@0.4.12
	slug@0.1.6
	smallvec@1.15.1
	smartstring@1.0.1
	spin@0.5.2
	stable_deref_trait@1.2.1
	static_assertions@1.1.0
	strsim@0.11.1
	syn@2.0.114
	tempfile@3.24.0
	termcolor@1.4.1
	termtree@0.5.1
	thin-vec@0.2.14
	thiserror@1.0.69
	thiserror@2.0.18
	thiserror-impl@1.0.69
	thiserror-impl@2.0.18
	time@0.3.47
	time-core@0.1.8
	time-macros@0.2.27
	tiny-keccak@2.0.2
	tinyvec@1.10.0
	tinyvec_macros@0.1.1
	tokio@1.49.0
	tokio-macros@2.6.0
	tokio-stream@0.1.18
	toml@0.8.23
	toml@1.1.2+spec-1.1.0
	toml_datetime@0.6.11
	toml_datetime@1.1.1+spec-1.1.0
	toml_edit@0.22.27
	toml_parser@1.1.2+spec-1.1.0
	toml_write@0.1.2
	toml_writer@1.1.1+spec-1.1.0
	tracing@0.1.44
	tracing-attributes@0.1.31
	tracing-core@0.1.36
	typenum@1.19.0
	ucd-trie@0.1.7
	unicode-bom@2.0.3
	unicode-ident@1.0.22
	unicode-normalization@0.1.25
	unicode-segmentation@1.12.0
	unicode-width@0.1.14
	unsafe-libyaml@0.2.11
	utf8parse@0.2.2
	version_check@0.9.5
	walkdir@2.5.0
	wasi@0.11.1+wasi-snapshot-preview1
	wasip2@1.0.2+wasi-0.2.9
	wasm-bindgen@0.2.108
	wasm-bindgen-macro@0.2.108
	wasm-bindgen-macro-support@0.2.108
	wasm-bindgen-shared@0.2.108
	watchexec@8.0.1
	watchexec-events@6.0.0
	watchexec-filterer-globset@8.0.0
	watchexec-filterer-ignore@7.0.0
	watchexec-signals@5.0.1
	watchexec-supervisor@5.0.2
	web-time@1.1.0
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.11
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows@0.62.2
	windows-collections@0.3.2
	windows-core@0.62.2
	windows-future@0.3.2
	windows-implement@0.60.2
	windows-interface@0.59.3
	windows-link@0.2.1
	windows-numerics@0.3.1
	windows-result@0.4.1
	windows-strings@0.5.1
	windows-sys@0.60.2
	windows-sys@0.61.2
	windows-targets@0.53.5
	windows-threading@0.2.1
	windows_aarch64_gnullvm@0.53.1
	windows_aarch64_msvc@0.53.1
	windows_i686_gnu@0.53.1
	windows_i686_gnullvm@0.53.1
	windows_i686_msvc@0.53.1
	windows_x86_64_gnu@0.53.1
	windows_x86_64_gnullvm@0.53.1
	windows_x86_64_msvc@0.53.1
	winnow@0.7.14
	winnow@1.0.1
	wit-bindgen@0.51.0
	zerocopy@0.8.39
	zerocopy-derive@0.8.39
	zmij@1.0.19
"

inherit cargo shell-completion optfeature

DESCRIPTION="A dotfile manager and templater written in rust"
HOMEPAGE="https://github.com/SuperCuber/dotter"

SRC_URI="
	copy? (
		https://github.com/SuperTux88/${PN}/archive/copy.tar.gz -> ${P}-copy.tar.gz
	)
	!copy? (
		https://github.com/SuperCuber/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
	)
	${CARGO_CRATE_URIS}
"
S="${WORKDIR}/${P}"

LICENSE="Unlicense"
# Dependent crate licenses
LICENSE+="
	AGPL-3 Apache-2.0 BSD-2 BSD CC0-1.0 ISC MIT MPL-2.0 Unicode-3.0
	Unlicense
"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+scripting +watch copy"

RUST_MIN_VER="1.88.0"

# 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}"
QA_PRESTRIPPED="${QA_FLAGS_IGNORED}"

src_unpack() {
	cargo_src_unpack

	if use copy; then
		rmdir "${S}" || die
		mv "${WORKDIR}/${PN}-copy" "${S}" || die
	fi
}

src_configure() {
	local myfeatures=(
		$(usev scripting)
		$(usev watch)
	)
	cargo_src_configure --no-default-features
}

src_compile() {
	cargo_src_compile

	$(cargo_target_dir)/${PN} gen-completions --shell bash > bash-completion.sh || die
	$(cargo_target_dir)/${PN} gen-completions --shell zsh > zsh-completion.zsh || die
}

src_install() {
	cargo_src_install

	newbashcomp bash-completion.sh ${PN}
	newzshcomp zsh-completion.zsh _${PN}
}

pkg_postinst() {
	optfeature "managing files with different owners" app-admin/sudo
}