forked from filebrowser/filebrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request filebrowser#618 from filebrowser/chores-version
Former-commit-id: e4a254c445bb6f9e6012800101812847f2f7a165 [formerly 39f8661c8cb8a37dd379bc87685fa266e2c98cc9] [formerly ad43c963e3adce98b64edb3324f9c4912b4a5623 [formerly 58edf87]] Former-commit-id: 66301024e8d6c34070382fb0b9db8e25a1055da1 [formerly cb29ecd9eec4ae6ae0cb422457ee1d794a51df20] Former-commit-id: d4eff084d7aad39e384ec9cc0cd3227250a195d3
- Loading branch information
Showing
11 changed files
with
74 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,7 @@ import ( | |
|
||
func checkErr(err error) { | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
log.Fatal(err) | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"text/template" | ||
|
||
"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", | ||
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) { | ||
fmt.Println("File Browser Version " + version.Version) | ||
// 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) | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters