From db6f3c3aa832855d861d7a0ea87d3914f793c5a5 Mon Sep 17 00:00:00 2001 From: rostrovsky Date: Mon, 5 Aug 2024 21:44:58 +0200 Subject: [PATCH] add version cmd --- main.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main.go b/main.go index 2e5d30e..88b8cb9 100644 --- a/main.go +++ b/main.go @@ -33,6 +33,10 @@ Your analysis should be thorough, insightful, and aimed at enabling AI agents to ` +const ( + version = "1.0.2" +) + var ( rFlag bool vFlag bool @@ -49,6 +53,14 @@ var rootCmd = &cobra.Command{ Run: run, } +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Prints the version of sourceprompt", + Run: func(cmd *cobra.Command, args []string) { + fmt.Printf("sourceprompt version %s\n", version) + }, +} + var programLevel *slog.LevelVar func init() { @@ -59,6 +71,8 @@ func init() { rootCmd.Flags().StringVarP(&eFlag, "exclude", "e", "", "Regular expression of filename patterns to exclude") rootCmd.Flags().StringVarP(&iFlag, "include", "i", "", "Regular expression of filename patterns to include") + rootCmd.AddCommand(versionCmd) + programLevel = new(slog.LevelVar) h := slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel}) slog.SetDefault(slog.New(h))