mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-05-08 11:22:10 +00:00

Former-commit-id: a08e327cccff4586578c71b6278b46c9d802f4dc [formerly 0b5e200ece501efd62b80c11f03518f5aac11c87] [formerly defeb96bda2355d30a5fd0d9e6a3b6c427b170b2 [formerly d5fcb555cbf17e5e1c9b87ab9545e9543706f910]] Former-commit-id: bf7ccdb941b150562153ba61609db38922191b97 [formerly d6250e9ca18bd318f0fdf742fc32e0404998e2f3] Former-commit-id: 867dec4689e6ed85b29c6501e37da85801783281
29 lines
627 B
Go
29 lines
627 B
Go
package cmd
|
|
|
|
import (
|
|
"text/template"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var versionCmd = &cobra.Command{
|
|
Use: "version",
|
|
Short: "Print the version number of File Browser",
|
|
Long: `All software has versions. This is File Browser's`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
// https://github.com/spf13/cobra/issues/724
|
|
t := template.New("version")
|
|
template.Must(t.Parse(rootCmd.VersionTemplate()))
|
|
err := t.Execute(rootCmd.OutOrStdout(), rootCmd)
|
|
if err != nil {
|
|
rootCmd.Println(err)
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(versionCmd)
|
|
serveCmd.AddCommand(versionCmd)
|
|
dbCmd.AddCommand(versionCmd)
|
|
}
|