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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
VERSION ?= $(shell git describe --tags --abbrev=0 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")

build:
@go build -o keyswift cmd/keyswift/main.go
@go build -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT)" -o keyswift cmd/keyswift/main.go
12 changes: 12 additions & 0 deletions cmd/keyswift/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ var (
flagConfig = flag.String("config", "", "Configuration file path (defaults to $XDG_CONFIG_HOME/keyswift/config.js)")
flagVerbose = flag.Bool("verbose", false, "Enable verbose logging")
flagOutputDeviceName = flag.String("output-device-name", "keyswift", "Name of the virtual keyboard device")
flagVersion = flag.Bool("version", false, "Print version information and exit")
)

// These variables are injected at compile time
var (
version = "dev"
commit = "unknown"
)

func main() {
flag.Parse()

if *flagVersion {
fmt.Printf("keyswift version %s (commit: %s)\n", version, commit)
os.Exit(0)
}

// Configure logging
if *flagVerbose {
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Expand Down