mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
6712fa580b
Former-commit-id: a9e681d47d47f9f09a22d8479705f62672f509b7 [formerly b7d17db57156675b06897bc289fe616628a47abb] [formerly e06d3b13b547356fb928288b09aaaaf1a60b8950 [formerly b4708348c6
]]
Former-commit-id: 43b18221e14269bada106e867b666f67a692c992 [formerly bee15f87fc2ecf5e8b4a0d74f41bde7617aef12a]
Former-commit-id: 733aaa6f3d5e3fc80dbb65ccc028d9f6ff6f73b7
33 lines
763 B
Go
33 lines
763 B
Go
package cmd
|
|
|
|
import (
|
|
"text/template"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(versionCmd)
|
|
cmdsCmd.AddCommand(versionCmd)
|
|
configCmd.AddCommand(versionCmd)
|
|
hashCmd.AddCommand(versionCmd)
|
|
upgradeCmd.AddCommand(versionCmd)
|
|
rulesCmd.AddCommand(versionCmd)
|
|
usersCmd.AddCommand(versionCmd)
|
|
}
|
|
|
|
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)
|
|
}
|
|
},
|
|
}
|