You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
feat: remove version cmd (#675)
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
Former-commit-id: 04a60c58f20d63ca7b25731c41e144bcf0f538cc [formerly e6e179799b64779515051df53352df5e63edc259] [formerly 0689eba81ff5f7ee3ea75db37b91cef4d6d8f35c [formerly 85899acae6]]
Former-commit-id: 96ca0cadb94131ddd3b57f0f11ad629edf687e40 [formerly 50130c75d39e67b15a645e7f4879acf34a5d6620]
Former-commit-id: 53b8120673a82217c3625de161d4ec57a96e1470
This commit is contained in:
@@ -1,32 +1,20 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
"fmt"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/version"
|
||||
"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`,
|
||||
Short: "Print the version number",
|
||||
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)
|
||||
}
|
||||
fmt.Println("File Browser Version " + version.Version)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user