feat: remove version cmd (#675)

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
pull/676/head
Henrique Dias 2019-02-15 12:54:44 +01:00 committed by GitHub
parent 4a4f635816
commit 85899acae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 44 deletions

View File

@ -12,7 +12,6 @@ func init() {
var cmdsCmd = &cobra.Command{
Use: "cmds",
Version: rootCmd.Version,
Short: "Command runner management utility",
Long: `Command runner management utility.`,
Args: cobra.NoArgs,

View File

@ -21,7 +21,6 @@ func init() {
var configCmd = &cobra.Command{
Use: "config",
Version: rootCmd.Version,
Short: "Configuration management utility",
Long: `Configuration management utility.`,
Args: cobra.NoArgs,

View File

@ -13,7 +13,6 @@ func init() {
var hashCmd = &cobra.Command{
Use: "hash <password>",
Version: rootCmd.Version,
Short: "Hashes a password",
Long: `Hashes a password using bcrypt algorithm.`,
Args: cobra.ExactArgs(1),

View File

@ -15,7 +15,6 @@ import (
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/filebrowser/filebrowser/v2/storage"
"github.com/filebrowser/filebrowser/v2/users"
"github.com/filebrowser/filebrowser/v2/version"
homedir "github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@ -56,7 +55,6 @@ func addServerFlags(flags *pflag.FlagSet) {
var rootCmd = &cobra.Command{
Use: "filebrowser",
Version: version.Version,
Short: "A stylish web-based file browser",
Long: `File Browser CLI lets you create the database to use with File Browser,
manage your users and all the configurations without acessing the

View File

@ -19,7 +19,6 @@ func init() {
var rulesCmd = &cobra.Command{
Use: "rules",
Version: rootCmd.Version,
Short: "Rules management utility",
Long: `On each subcommand you'll have available at least two flags:
"username" and "id". You must either set only one of them

View File

@ -15,7 +15,6 @@ func init() {
var upgradeCmd = &cobra.Command{
Use: "upgrade",
Version: rootCmd.Version,
Short: "Upgrades an old configuration",
Long: `Upgrades an old configuration. This command DOES NOT
import share links because they are incompatible with

View File

@ -19,7 +19,6 @@ func init() {
var usersCmd = &cobra.Command{
Use: "users",
Version: rootCmd.Version,
Short: "Users management utility",
Long: `Users management utility.`,
Args: cobra.NoArgs,

View File

@ -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)
},
}