diff --git a/cmd/server/main.go b/cmd/server/main.go index 6ede011..5cc740d 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -11,6 +11,9 @@ import ( "syscall" ) +// version is set at build time using -ldflags "-X main.version=1.0.0" +var version string = "unknown" + // @title llamactl API // @version 1.0 // @description llamactl is a control server for managing Llama Server instances. @@ -19,6 +22,12 @@ import ( // @basePath /api/v1 func main() { + // --version flag to print the version + if len(os.Args) > 1 && os.Args[1] == "--version" { + fmt.Printf("llamactl version: %s\n", version) + return + } + configPath := os.Getenv("LLAMACTL_CONFIG_PATH") cfg, err := config.LoadConfig(configPath) if err != nil {