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

# Autogenerated by pycargoebuild 0.16.0

EAPI=8

# kdl@6.7.1 requires rust-version 1.95
RUST_MIN_VER="1.95.0"

CRATES=""

inherit cargo shell-completion

DESCRIPTION="Spec and CLI for defining CLI tools (completions, docs, man pages)"
HOMEPAGE="https://usage.jdx.dev https://github.com/jdx/usage"
SRC_URI="https://github.com/jdx/usage/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" https://github.com/0x6d6e647a/mndz-overlay-assets/releases/download/usage-${PV}/usage-${PV}-crates.tar.xz"

LICENSE="MIT"
# Dependent crate licenses
LICENSE+=" Apache-2.0 ISC MIT Unicode-3.0"
SLOT="0"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
IUSE="bash-completion fish-completion zsh-completion"

# rust does not use *FLAGS from make.conf, silence portage warning
QA_FLAGS_IGNORED="usr/bin/usage"

src_install() {
	cargo_src_install --path cli
	dodoc README.md CHANGELOG.md
	doman cli/assets/usage.1

	use bash-completion &&
		newbashcomp cli/assets/completions/usage.bash usage
	use fish-completion &&
		newfishcomp cli/assets/completions/usage.fish usage.fish
	use zsh-completion &&
		newzshcomp cli/assets/completions/_usage _usage
}