-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
feature: add more version information to both cmd and router
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package app | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/dragonflyoss/Dragonfly/version" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// versionDescription is used to describe version command in detail and auto generate command doc. | ||
var versionDescription = "Display the version and build information of Dragonfly dfdaemon, " + | ||
"including GoVersion, OS, Arch, Version, BuildDate and GitCommit." | ||
|
||
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "Show the current version of dfdaemon", | ||
Long: versionDescription, | ||
SilenceErrors: true, | ||
SilenceUsage: true, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
fmt.Println(version.Print("dfdaemon")) | ||
return nil | ||
}, | ||
Example: versionExample(), | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(versionCmd) | ||
} | ||
|
||
// versionExample shows examples in version command, and is used in auto-generated cli docs. | ||
func versionExample() string { | ||
return `dfdaemon, version 0.4.1 | ||
Git commit: 6fd5c8f | ||
Build date: 20190717-15:57:52 | ||
Go version: go1.12.6 | ||
OS/Arch: linux/amd64 | ||
` | ||
} |