2018-08-21 21:42:03 +00:00
|
|
|
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)
|
2018-08-22 11:30:55 +00:00
|
|
|
serveCmd.AddCommand(versionCmd)
|
|
|
|
dbCmd.AddCommand(versionCmd)
|
2018-08-21 21:42:03 +00:00
|
|
|
}
|