Skip to content

Commit

Permalink
fix(daemon): added version subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
lanathlor committed Dec 9, 2024
1 parent fb2af2d commit 5dbf449
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/daemon/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func rootCmd() *cobra.Command {
// Common flags
verbose.AddAsFlag(cmd, true)
// SubCommands
cmd.AddCommand(versionCmd())
cmd.AddCommand(run.RunCmd())
return cmd
}
23 changes: 23 additions & 0 deletions cmd/daemon/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package daemon

import (
"fmt"

"stamus-ctl/internal/app"

"github.com/spf13/cobra"
)

func printVersion() {
fmt.Printf("version: %s\narch: %s\ncommit: %s\n", app.Version, app.Arch, app.Commit)
}

func versionCmd() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Version information",
Run: func(cmd *cobra.Command, args []string) {
printVersion()
},
}
}

0 comments on commit 5dbf449

Please sign in to comment.