github.com/soulteary/pocket-bookcase@v0.0.0-20240428065142-0b5a9a0fc98a/internal/cmd/version.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/soulteary/pocket-bookcase/internal/model"
     5  	"github.com/spf13/cobra"
     6  )
     7  
     8  func newVersionCommand() *cobra.Command {
     9  	cmd := &cobra.Command{
    10  		Use:   "version",
    11  		Short: "Output the shiori version",
    12  		Run:   newVersionCommandHandler(),
    13  	}
    14  
    15  	return cmd
    16  }
    17  
    18  func newVersionCommandHandler() func(cmd *cobra.Command, args []string) {
    19  	return func(cmd *cobra.Command, args []string) {
    20  		cmd.Printf("Shiori version %s (build %s) at %s\n", model.BuildVersion, model.BuildCommit, model.BuildDate)
    21  	}
    22  }