Skip to content

Commit

Permalink
add version command
Browse files Browse the repository at this point in the history
  • Loading branch information
gphorvath committed Nov 2, 2024
1 parent 3f8d350 commit 8578b8e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/grimoire/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
var (
clipSvc *clipboard.Service
promptMgr *prompt.Manager
version = "dev" // This will be set during build
)

func handleError(err error, message string) {
Expand All @@ -32,6 +33,14 @@ var rootCmd = &cobra.Command{
Copy prompts directly to your clipboard with simple commands.`,
}

var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("grimoire version %s\n", version)
},
}

var listCmd = &cobra.Command{
Use: "list",
Short: "List available prompts",
Expand Down Expand Up @@ -85,6 +94,7 @@ func init() {
}

clipSvc = clipboard.New()
rootCmd.AddCommand(versionCmd)
rootCmd.AddCommand(listCmd)
rootCmd.AddCommand(copyCmd)
rootCmd.AddCommand(pasteCmd)
Expand Down

0 comments on commit 8578b8e

Please sign in to comment.