File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1+ VERSION ?= $(shell git describe --tags --abbrev=0 2>/dev/null || echo "dev")
2+ COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
3+
14build :
2- @go build -o keyswift cmd/keyswift/main.go
5+ @go build -ldflags " -X main.version= $( VERSION ) -X main.commit= $( COMMIT ) " - o keyswift cmd/keyswift/main.go
Original file line number Diff line number Diff line change @@ -25,11 +25,23 @@ var (
2525 flagConfig = flag .String ("config" , "" , "Configuration file path (defaults to $XDG_CONFIG_HOME/keyswift/config.js)" )
2626 flagVerbose = flag .Bool ("verbose" , false , "Enable verbose logging" )
2727 flagOutputDeviceName = flag .String ("output-device-name" , "keyswift" , "Name of the virtual keyboard device" )
28+ flagVersion = flag .Bool ("version" , false , "Print version information and exit" )
29+ )
30+
31+ // These variables are injected at compile time
32+ var (
33+ version = "dev"
34+ commit = "unknown"
2835)
2936
3037func main () {
3138 flag .Parse ()
3239
40+ if * flagVersion {
41+ fmt .Printf ("keyswift version %s (commit: %s)\n " , version , commit )
42+ os .Exit (0 )
43+ }
44+
3345 // Configure logging
3446 if * flagVerbose {
3547 slog .SetDefault (slog .New (slog .NewTextHandler (os .Stderr , & slog.HandlerOptions {
You can’t perform that action at this time.
0 commit comments