feat: remove version cmd (#675)
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
1 parent
4a4f635816
commit
85899acae6
8 files changed
+24
-44
No files matched your search
+4
-16
@@ -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