Skip to content

Commit

Permalink
add version cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
rostrovsky committed Aug 5, 2024
1 parent eaf75bb commit db6f3c3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand All @@ -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))
Expand Down

0 comments on commit db6f3c3

Please sign in to comment.