add API viewer, mv repl subcommand to api (#41)

This commit is contained in:
T. von Dein
2026-06-17 13:11:09 +02:00
parent 072e949147
commit f1ff361c12
14 changed files with 161829 additions and 267 deletions

View File

@@ -23,17 +23,27 @@ UID = root
GID = 0
HAVE_POD := $(shell pod2text -h 2>/dev/null)
BRANCH = $(shell git branch --show-current)
COMMIT = $(shell git rev-parse --short=8 HEAD)
BUILD = $(shell date +%Y.%m.%d.%H%M%S)
GOVERSION = $(shell grep -E "^go" go.mod | cut -d' ' -f2)
APIVERSION = $(shell grep github.com/elastic/go-elasticsearch go.mod | cut -d' ' -f2)
BRANCH = $(shell git branch --show-current)
COMMIT = $(shell git rev-parse --short=8 HEAD)
BUILD = $(shell date +%Y.%m.%d.%H%M%S)
GOVERSION = $(shell grep -E "^go" go.mod | cut -d' ' -f2)
APIVERSION = $(shell grep github.com/elastic/go-elasticsearch go.mod | cut -d' ' -f2)
APISPEC = "https://www.elastic.co/docs/api/doc/elasticsearch.json"
all: buildlocal
buildlocal:
# pkg/es/openspec.go:
# echo "package es" > pkg/es/openspec.go
# echo >> pkg/es/openspec.go
# echo "const Openspec = \`" >> pkg/es/openspec.go
# curl -o - $(APISPEC) | sed "s/\`/'/g" >> pkg/es/openspec.go
# echo "\`" >> pkg/es/openspec.go
assets/openapi.json:
curl -o assets/openapi.json $(APISPEC)
buildlocal: assets/openapi.json
CGO_LDFLAGS='-static' go build -tags osusergo,netgo -ldflags "-extldflags=-static" \
-ldflags "-X codeberg.org/scip/esctl/pkg/cfg.BRANCH=$(BRANCH) \
-X codeberg.org/scip/esctl/pkg/cfg.COMMIT=$(COMMIT) \
@@ -50,7 +60,7 @@ install: buildlocal
install -o $(UID) -g $(GID) -m 444 $(tool).1 $(PREFIX)/man/man1/
clean:
rm -rf $(tool) coverage.out testdata t/out
rm -rf $(tool) coverage.out testdata t/out pkg/es/openspec.go
test: clean
mkdir -p t/out