Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/labeler-config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"bug": '\b([Bb]ug(s)?|[Ee]rror(s)?|[Ff]ix(es)?|[Ii]ssue(s)?)\b'
"bug": '\b([Bb]ug(s)?|[Ee]rror(s)?|[Ff]ix(es)?)\b'

"enhancement": '\b([Ee]nhancement(s)?|[Ff]eature(s)?|[Ii]dea(s)?|[Ss]uggestion(s)?[Ff]eat(s)?)\b'

Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build test run clean lint fmt vet
.PHONY: build test run clean lint fmt vet build-full

BINARY_NAME=matcha
BUILD_DIR=bin
Expand All @@ -11,6 +11,16 @@ generate_gif:
build:
go build -o $(BUILD_DIR)/$(BINARY_NAME) .

build-full:
@echo "Building with version information..."
@VERSION=$$(git describe --tags --abbrev=0 2>/dev/null || echo "dev"); \
COMMIT=$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown"); \
DATE=$$(date +%Y-%m-%d); \
echo "Version: $$VERSION"; \
echo "Commit: $$COMMIT"; \
echo "Date: $$DATE"; \
go build -ldflags="-X 'main.version=$$VERSION' -X 'main.commit=$$COMMIT' -X 'main.date=$$DATE'" -o $(BUILD_DIR)/$(BINARY_NAME)-full .;

run:
go run .

Expand Down
13 changes: 13 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1952,6 +1952,19 @@ func filterUnique(existing, incoming []fetcher.Email) []fetcher.Email {
}

func main() {
// If invoked with version flag, print version and exit
if len(os.Args) > 1 && (os.Args[1] == "-v" || os.Args[1] == "--version" || os.Args[1] == "version") {
fmt.Printf("matcha version %s", version)
if commit != "" {
fmt.Printf(" (%s)", commit)
}
if date != "" {
fmt.Printf(" built on %s", date)
}
fmt.Println()
os.Exit(0)
}

// If invoked as CLI update command, run updater and exit.
if len(os.Args) > 1 && os.Args[1] == "update" {
if err := runUpdateCLI(); err != nil {
Expand Down