Add Makefile and .gitignore; update README for build instructions

This commit is contained in:
jolts 2025-01-24 13:22:02 +02:00
parent e356cc6c4e
commit d211684f48
3 changed files with 69 additions and 6 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
bin/
vendor/
tmp/

60
Makefile Normal file
View file

@ -0,0 +1,60 @@
.PHONY: build debug clean
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
BIN_DIR := bin
BIN_NAME := issue_cli
build_all: build_amd64 build_arm64 build_386 build_arm build_ppc64 build_ppc64le build_s390x build_mips64 build_windows build_windows_386
build:
ifeq ($(GOOS),windows)
$(MAKE) build_windows
else
$(MAKE) build_single
endif
build_amd64:
GOARCH=amd64 $(MAKE) build_single
build_arm64:
GOARCH=arm64 $(MAKE) build_single
build_386:
GOARCH=386 $(MAKE) build_single
build_arm:
GOARCH=arm GOARM=7 $(MAKE) build_single
build_ppc64:
GOARCH=ppc64 $(MAKE) build_single
build_ppc64le:
GOARCH=ppc64le $(MAKE) build_single
build_s390x:
GOARCH=s390x $(MAKE) build_single
build_mips64:
GOARCH=mips64 $(MAKE) build_single
build_windows:
$(MAKE) build_single_windows GOOS=windows GOARCH=amd64
build_windows_386:
$(MAKE) build_single_windows GOOS=windows GOARCH=386
build_single_windows:
go build -o $(BIN_DIR)/$(BIN_NAME)-$(GOOS)-$(GOARCH).exe
build_single:
go build -o $(BIN_DIR)/$(BIN_NAME)-$(GOOS)-$(GOARCH)
debug:
go build -tags debug -gcflags "all=-N -l" -o $(BIN_DIR)/$(BIN_NAME)-$(GOOS)-$(GOARCH)-debug
clean:
@rm -rf $(BIN_DIR)
proto:
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative protos/*.proto

View file

@ -25,12 +25,12 @@ This project is a command-line tool that fetches GitHub issue data and reconstru
2. Change to the project directory: 2. Change to the project directory:
```sh ```sh
cd tools_issue_cli§ cd issue_cli
``` ```
3. Build the project: 3. Build the project:
```sh ```sh
go build -o tools_issue_cli make build
``` ```
## Usage ## Usage
@ -44,7 +44,7 @@ You can use the tool to fetch a GitHub issue and output it in either Markdown or
To fetch an issue and output it as Markdown: To fetch an issue and output it as Markdown:
```sh ```sh
./tools_issue_cli fetch --url https://github.com/owner/repo/issues/1 --output issue.md --format markdown ./issue_cli fetch --url https://github.com/owner/repo/issues/1 --output issue.md --format markdown
``` ```
#### Fetch and Output as HTML #### Fetch and Output as HTML
@ -52,7 +52,7 @@ To fetch an issue and output it as Markdown:
To fetch an issue and output it as HTML: To fetch an issue and output it as HTML:
```sh ```sh
./tools_issue_cli fetch --url https://github.com/owner/repo/issues/1 --output issue.html --format html ./issue_cli fetch --url https://github.com/owner/repo/issues/1 --output issue.html --format html
``` ```
### Command-Line Options ### Command-Line Options
@ -66,11 +66,11 @@ To fetch an issue and output it as HTML:
### Fetch an Issue and Output as Markdown ### Fetch an Issue and Output as Markdown
```sh ```sh
./tools_issue_cli fetch --url https://github.com/dnnyxyz/dnnyxyz.github.io/issues/1 --output issue.md --format markdown ./issue_cli fetch --url https://github.com/dnnyxyz/dnnyxyz.github.io/issues/1 --output issue.md --format markdown
``` ```
### Fetch an Issue and Output as HTML ### Fetch an Issue and Output as HTML
```sh ```sh
./tools_issue_cli fetch --url https://github.com/dnnyxyz/dnnyxyz.github.io/issues/1 --output issue.html --format html ./issue_cli fetch --url https://github.com/dnnyxyz/dnnyxyz.github.io/issues/1 --output issue.html --format html
``` ```