aboutsummaryrefslogtreecommitdiff
blob: 682f571b79af6160d3ad196872cf91204ca52b4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="Bash scripts that integrate bat with various command line tools."
HOMEPAGE="https://github.com/eth-p/bat-extras"
if [[ ${PV} == *9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/eth-p/bat-extras.git"
	RESTRICT="mirror fetch"
else
	SRC_URI="https://github.com/eth-p/bat-extras/archive/v${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~amd64"
	RESTRICT="mirror test"
fi

LICENSE="MIT"
SLOT="0"
IUSE="+man"

DEPEND="
	app-shells/bash
	sys-apps/bat
	dev-util/sh
"
RDEPEND="
	${DEPEND}
	dev-vcs/git
	sys-apps/ripgrep
	app-admin/entr
	dev-util/git-delta
	sys-devel/clang
	sys-apps/exa
	app-shells/fzf
	sys-libs/ncurses
	dev-python/black
	virtual/rust[rustfmt(+)]
"

S="${WORKDIR}/${P}"

src_unpack() {
	default
	if [[ ${PV} == *9999 ]]; then
		git-r3_checkout
	fi
}

src_prepare() {
	# remove license
	rm LICENSE.md || die
	# remove contribution document
	rm CONTRIBUTING.md || die
	default
}

src_compile() {
	if use man; then
		./build.sh --compress --minify=all --manuals --no-verify || die "build failed"
	else
		./build.sh --compress --minify=all --no-verify || die "build failed"
	fi
}

src_test() {
	./test.sh || die "test failed"
}

src_install() {
	dobin bin/*
	if use man; then
		doman man/*
	fi
}

pkg_postinst() {
	einfo "To enable additional code formatting for 'prettybat' script, ensure"
	einfo "'net-libs/nodejs' is installed in your system, and use 'npm' to install"
	einfo "'prettier' (npm i -g prettier). Once 'prettier' is properly installed in"
	einfo "your system, remerge this pacakge."
}