# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit edo go-module shell-completion

COMMIT="293ab5c"
EGO_SUM=(
	"github.com/IBM/sarama v1.43.2"
	"github.com/IBM/sarama v1.43.2/go.mod"
	"github.com/Rican7/retry v0.3.1"
	"github.com/Rican7/retry v0.3.1/go.mod"
	"github.com/benbjohnson/clock v1.3.5"
	"github.com/benbjohnson/clock v1.3.5/go.mod"
	"github.com/bufbuild/protocompile v0.14.0"
	"github.com/bufbuild/protocompile v0.14.0/go.mod"
	"github.com/cpuguy83/go-md2man/v2 v2.0.4"
	"github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod"
	"github.com/davecgh/go-spew v1.1.0/go.mod"
	"github.com/davecgh/go-spew v1.1.1/go.mod"
	"github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc"
	"github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod"
	"github.com/eapache/go-resiliency v1.7.0"
	"github.com/eapache/go-resiliency v1.7.0/go.mod"
	"github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3"
	"github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3/go.mod"
	"github.com/eapache/queue v1.1.0"
	"github.com/eapache/queue v1.1.0/go.mod"
	"github.com/fatih/color v1.13.0/go.mod"
	"github.com/fatih/color v1.17.0"
	"github.com/fatih/color v1.17.0/go.mod"
	"github.com/fortytw2/leaktest v1.3.0"
	"github.com/fortytw2/leaktest v1.3.0/go.mod"
	"github.com/frankban/quicktest v1.14.6"
	"github.com/frankban/quicktest v1.14.6/go.mod"
	"github.com/fsnotify/fsnotify v1.7.0"
	"github.com/fsnotify/fsnotify v1.7.0/go.mod"
	"github.com/golang/protobuf v1.5.4"
	"github.com/golang/protobuf v1.5.4/go.mod"
	"github.com/golang/snappy v0.0.1/go.mod"
	"github.com/golang/snappy v0.0.4"
	"github.com/golang/snappy v0.0.4/go.mod"
	"github.com/google/go-cmp v0.6.0"
	"github.com/google/go-cmp v0.6.0/go.mod"
	"github.com/gorilla/securecookie v1.1.1/go.mod"
	"github.com/gorilla/sessions v1.2.1/go.mod"
	"github.com/hashicorp/errwrap v1.0.0/go.mod"
	"github.com/hashicorp/errwrap v1.1.0"
	"github.com/hashicorp/errwrap v1.1.0/go.mod"
	"github.com/hashicorp/go-hclog v1.6.3"
	"github.com/hashicorp/go-hclog v1.6.3/go.mod"
	"github.com/hashicorp/go-multierror v1.1.1"
	"github.com/hashicorp/go-multierror v1.1.1/go.mod"
	"github.com/hashicorp/go-plugin v1.6.1"
	"github.com/hashicorp/go-plugin v1.6.1/go.mod"
	"github.com/hashicorp/go-uuid v1.0.2/go.mod"
	"github.com/hashicorp/go-uuid v1.0.3"
	"github.com/hashicorp/go-uuid v1.0.3/go.mod"
	"github.com/hashicorp/hcl v1.0.0"
	"github.com/hashicorp/hcl v1.0.0/go.mod"
	"github.com/hashicorp/yamux v0.1.1"
	"github.com/hashicorp/yamux v0.1.1/go.mod"
	"github.com/inconshreveable/mousetrap v1.1.0"
	"github.com/inconshreveable/mousetrap v1.1.0/go.mod"
	"github.com/jcmturner/aescts/v2 v2.0.0"
	"github.com/jcmturner/aescts/v2 v2.0.0/go.mod"
	"github.com/jcmturner/dnsutils/v2 v2.0.0"
	"github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod"
	"github.com/jcmturner/gofork v1.7.6"
	"github.com/jcmturner/gofork v1.7.6/go.mod"
	"github.com/jcmturner/goidentity/v6 v6.0.1"
	"github.com/jcmturner/goidentity/v6 v6.0.1/go.mod"
	"github.com/jcmturner/gokrb5/v8 v8.4.4"
	"github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod"
	"github.com/jcmturner/rpc/v2 v2.0.3"
	"github.com/jcmturner/rpc/v2 v2.0.3/go.mod"
	"github.com/jhump/protoreflect v1.16.0"
	"github.com/jhump/protoreflect v1.16.0/go.mod"
	"github.com/klauspost/compress v1.17.9"
	"github.com/klauspost/compress v1.17.9/go.mod"
	"github.com/kr/pretty v0.1.0/go.mod"
	"github.com/kr/pretty v0.3.1"
	"github.com/kr/pretty v0.3.1/go.mod"
	"github.com/kr/pty v1.1.1/go.mod"
	"github.com/kr/text v0.1.0/go.mod"
	"github.com/kr/text v0.2.0"
	"github.com/kr/text v0.2.0/go.mod"
	"github.com/linkedin/goavro/v2 v2.11.1/go.mod"
	"github.com/linkedin/goavro/v2 v2.13.0"
	"github.com/linkedin/goavro/v2 v2.13.0/go.mod"
	"github.com/magiconair/properties v1.8.7"
	"github.com/magiconair/properties v1.8.7/go.mod"
	"github.com/mattn/go-colorable v0.1.9/go.mod"
	"github.com/mattn/go-colorable v0.1.12/go.mod"
	"github.com/mattn/go-colorable v0.1.13"
	"github.com/mattn/go-colorable v0.1.13/go.mod"
	"github.com/mattn/go-isatty v0.0.12/go.mod"
	"github.com/mattn/go-isatty v0.0.14/go.mod"
	"github.com/mattn/go-isatty v0.0.16/go.mod"
	"github.com/mattn/go-isatty v0.0.20"
	"github.com/mattn/go-isatty v0.0.20/go.mod"
	"github.com/mitchellh/go-testing-interface v1.14.1"
	"github.com/mitchellh/go-testing-interface v1.14.1/go.mod"
	"github.com/mitchellh/mapstructure v1.5.0"
	"github.com/mitchellh/mapstructure v1.5.0/go.mod"
	"github.com/oklog/run v1.1.0"
	"github.com/oklog/run v1.1.0/go.mod"
	"github.com/pelletier/go-toml/v2 v2.2.2"
	"github.com/pelletier/go-toml/v2 v2.2.2/go.mod"
	"github.com/pierrec/lz4/v4 v4.1.21"
	"github.com/pierrec/lz4/v4 v4.1.21/go.mod"
	"github.com/pkg/errors v0.9.1"
	"github.com/pkg/errors v0.9.1/go.mod"
	"github.com/pmezard/go-difflib v1.0.0/go.mod"
	"github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2"
	"github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod"
	"github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475"
	"github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod"
	"github.com/riferrei/srclient v0.6.0"
	"github.com/riferrei/srclient v0.6.0/go.mod"
	"github.com/rogpeppe/go-internal v1.12.0"
	"github.com/rogpeppe/go-internal v1.12.0/go.mod"
	"github.com/russross/blackfriday/v2 v2.1.0"
	"github.com/russross/blackfriday/v2 v2.1.0/go.mod"
	"github.com/sagikazarmark/locafero v0.6.0"
	"github.com/sagikazarmark/locafero v0.6.0/go.mod"
	"github.com/sagikazarmark/slog-shim v0.1.0"
	"github.com/sagikazarmark/slog-shim v0.1.0/go.mod"
	"github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod"
	"github.com/santhosh-tekuri/jsonschema/v5 v5.3.1"
	"github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod"
	"github.com/sourcegraph/conc v0.3.0"
	"github.com/sourcegraph/conc v0.3.0/go.mod"
	"github.com/spf13/afero v1.11.0"
	"github.com/spf13/afero v1.11.0/go.mod"
	"github.com/spf13/cast v1.7.0"
	"github.com/spf13/cast v1.7.0/go.mod"
	"github.com/spf13/cobra v1.8.1"
	"github.com/spf13/cobra v1.8.1/go.mod"
	"github.com/spf13/pflag v1.0.5"
	"github.com/spf13/pflag v1.0.5/go.mod"
	"github.com/spf13/viper v1.19.0"
	"github.com/spf13/viper v1.19.0/go.mod"
	"github.com/stretchr/objx v0.1.0/go.mod"
	"github.com/stretchr/objx v0.4.0/go.mod"
	"github.com/stretchr/objx v0.5.0/go.mod"
	"github.com/stretchr/objx v0.5.2/go.mod"
	"github.com/stretchr/testify v1.4.0/go.mod"
	"github.com/stretchr/testify v1.7.1/go.mod"
	"github.com/stretchr/testify v1.7.2/go.mod"
	"github.com/stretchr/testify v1.7.5/go.mod"
	"github.com/stretchr/testify v1.8.0/go.mod"
	"github.com/stretchr/testify v1.8.1/go.mod"
	"github.com/stretchr/testify v1.8.4/go.mod"
	"github.com/stretchr/testify v1.9.0"
	"github.com/stretchr/testify v1.9.0/go.mod"
	"github.com/subosito/gotenv v1.6.0"
	"github.com/subosito/gotenv v1.6.0/go.mod"
	"github.com/xdg-go/pbkdf2 v1.0.0"
	"github.com/xdg-go/pbkdf2 v1.0.0/go.mod"
	"github.com/xdg-go/scram v1.1.2"
	"github.com/xdg-go/scram v1.1.2/go.mod"
	"github.com/xdg-go/stringprep v1.0.4"
	"github.com/xdg-go/stringprep v1.0.4/go.mod"
	"github.com/yuin/goldmark v1.4.13/go.mod"
	"go.uber.org/atomic v1.11.0"
	"go.uber.org/atomic v1.11.0/go.mod"
	"go.uber.org/multierr v1.11.0"
	"go.uber.org/multierr v1.11.0/go.mod"
	"go.uber.org/ratelimit v0.3.1"
	"go.uber.org/ratelimit v0.3.1/go.mod"
	"golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod"
	"golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod"
	"golang.org/x/crypto v0.6.0/go.mod"
	"golang.org/x/crypto v0.26.0"
	"golang.org/x/crypto v0.26.0/go.mod"
	"golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56"
	"golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod"
	"golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod"
	"golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod"
	"golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod"
	"golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod"
	"golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod"
	"golang.org/x/net v0.6.0/go.mod"
	"golang.org/x/net v0.7.0/go.mod"
	"golang.org/x/net v0.28.0"
	"golang.org/x/net v0.28.0/go.mod"
	"golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod"
	"golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod"
	"golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod"
	"golang.org/x/sync v0.8.0"
	"golang.org/x/sync v0.8.0/go.mod"
	"golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod"
	"golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod"
	"golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod"
	"golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod"
	"golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod"
	"golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod"
	"golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod"
	"golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod"
	"golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod"
	"golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod"
	"golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod"
	"golang.org/x/sys v0.5.0/go.mod"
	"golang.org/x/sys v0.6.0/go.mod"
	"golang.org/x/sys v0.23.0"
	"golang.org/x/sys v0.23.0/go.mod"
	"golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod"
	"golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod"
	"golang.org/x/term v0.5.0/go.mod"
	"golang.org/x/term v0.23.0"
	"golang.org/x/term v0.23.0/go.mod"
	"golang.org/x/text v0.3.0/go.mod"
	"golang.org/x/text v0.3.3/go.mod"
	"golang.org/x/text v0.3.7/go.mod"
	"golang.org/x/text v0.3.8/go.mod"
	"golang.org/x/text v0.7.0/go.mod"
	"golang.org/x/text v0.17.0"
	"golang.org/x/text v0.17.0/go.mod"
	"golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod"
	"golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod"
	"golang.org/x/tools v0.1.12/go.mod"
	"golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod"
	"google.golang.org/genproto/googleapis/rpc v0.0.0-20240805194559-2c9e96a0b5d4"
	"google.golang.org/genproto/googleapis/rpc v0.0.0-20240805194559-2c9e96a0b5d4/go.mod"
	"google.golang.org/grpc v1.65.0"
	"google.golang.org/grpc v1.65.0/go.mod"
	"google.golang.org/protobuf v1.34.2"
	"google.golang.org/protobuf v1.34.2/go.mod"
	"gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod"
	"gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod"
	"gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c"
	"gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod"
	"gopkg.in/errgo.v2 v2.1.0"
	"gopkg.in/errgo.v2 v2.1.0/go.mod"
	"gopkg.in/ini.v1 v1.67.0"
	"gopkg.in/ini.v1 v1.67.0/go.mod"
	"gopkg.in/yaml.v2 v2.2.2/go.mod"
	"gopkg.in/yaml.v2 v2.4.0"
	"gopkg.in/yaml.v2 v2.4.0/go.mod"
	"gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod"
	"gopkg.in/yaml.v3 v3.0.1"
	"gopkg.in/yaml.v3 v3.0.1/go.mod"
	)
go-module_set_globals

DESCRIPTION="A command-line interface for interaction with Apache Kafka"
HOMEPAGE="https://github.com/deviceinsight/kafkactl"
SRC_URI="https://github.com/deviceinsight/kafkactl/archive/v${PV}.tar.gz -> ${P}.tar.gz
	${EGO_SUM_SRC_URI}"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"

DOCS=( CHANGELOG.md README.adoc )

src_compile() {
	DATE="$(date -u '+%Y-%m-%d-%H%M UTC')"
	LDFLAGS="-w -X github.com/deviceinsight/kafkactl/v5/cmd.Version=${PV}
	-X github.com/deviceinsight/kafkactl/v5/cmd.GitCommit=${COMMIT}
	-X \"github.com/deviceinsight/kafkactl/v5/cmd.BuildTime=${DATE}\""

	ego build -buildmode=pie \
		-ldflags "${LDFLAGS}" -trimpath -o kafkactl

	local completion
	for completion in bash fish zsh ; do
		edo ./kafkactl completion "${completion}" > kafkactl."${completion}"
	done
}

src_install() {
	einstalldocs
	dobin kafkactl
	newbashcomp kafkactl.bash kafkactl
	dofishcomp kafkactl.fish kafkactl
	newzshcomp kafkactl.zsh _kafkactl
}