feat: Add version print
This commit is contained in:
@ -28,6 +28,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"git.vinchent.xyz/vinchent/howmuch/internal/pkg/log"
|
||||
"git.vinchent.xyz/vinchent/howmuch/pkg/version/verflag"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/spf13/cobra"
|
||||
@ -48,6 +49,9 @@ func NewHowMuchCommand() *cobra.Command {
|
||||
Long: `howmuch is a expense-sharing application that can help friends
|
||||
to share their expense of an event or a trip`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
// print version and exit?
|
||||
verflag.PrintVersion()
|
||||
|
||||
// init log
|
||||
log.Init(logOptions())
|
||||
// Sync flush the buffer
|
||||
@ -78,6 +82,9 @@ to share their expense of an event or a trip`,
|
||||
// when this action is called directly.
|
||||
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
|
||||
// --version
|
||||
verflag.AddFlags(rootCmd.PersistentFlags())
|
||||
|
||||
return rootCmd
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user