feat: print version

Amolith created

Only works if you build with (a command similar to) the command in the build
task of the justfile.

Change summary

main.go | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Detailed changes

main.go 🔗

@@ -51,10 +51,18 @@ type Config struct {
 	Timezone    string       `toml:"timezone"`
 }
 
+var version = ""
+
 func main() {
 	configPath := "./config.toml"
 	for i, arg := range os.Args {
-		if arg == "-c" || arg == "--config" {
+		if arg == "-v" || arg == "--version" {
+			if version == "" {
+				version = "unknown, build with `just build` or copy/paste the build command from ./justfile"
+			}
+			fmt.Println("lunatask-mcp-server:", version)
+			os.Exit(0)
+		} else if arg == "-c" || arg == "--config" {
 			if i+1 < len(os.Args) {
 				configPath = os.Args[i+1]
 			}