-
Notifications
You must be signed in to change notification settings - Fork 646
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added bbolt command line version flag to get runtime information.
Signed-off-by: Ishan Tyagi <[email protected]>
- Loading branch information
1 parent
b7798fd
commit 68ba6d6
Showing
5 changed files
with
59 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
"go.etcd.io/bbolt/version" | ||
) | ||
|
||
func newVersionCobraCommand() *cobra.Command { | ||
versionCmd := &cobra.Command{ | ||
Use: "version", | ||
Short: "print the current version of bbolt", | ||
Long: "print the current version of bbolt", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Fprintln(os.Stdout, version.PrintVersionInfo()) | ||
}, | ||
} | ||
|
||
return versionCmd | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package version | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
) | ||
|
||
var ( | ||
// Version shows the last bbolt binary version released. | ||
Version = "1.3.7" | ||
) | ||
|
||
// PrintVersionInfo prints the information regrading version. | ||
func PrintVersionInfo() string { | ||
return fmt.Sprintf( | ||
"bbolt version: %s \nGo Version: %s \nGo OS/Arch: %s/%s", | ||
Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, | ||
) | ||
} |