mirror of
https://github.com/etcd-io/bbolt.git
synced 2025-05-02 13:39:45 +00:00
Merge pull request #552 from ishan16696/versionFlag
Added bbolt command line version flag to get runtime information.
This commit is contained in:
commit
0e7d8a6fe9
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
The commands are:
|
The commands are:
|
||||||
|
|
||||||
|
version prints the current version of bbolt
|
||||||
bench run synthetic benchmark against bbolt
|
bench run synthetic benchmark against bbolt
|
||||||
buckets print a list of buckets
|
buckets print a list of buckets
|
||||||
check verifies integrity of bbolt database
|
check verifies integrity of bbolt database
|
||||||
@ -60,6 +61,21 @@
|
|||||||
|
|
||||||
## Analyse bbolt database with bbolt command line
|
## Analyse bbolt database with bbolt command line
|
||||||
|
|
||||||
|
### version
|
||||||
|
|
||||||
|
- `version` print the current version information of bbolt command-line.
|
||||||
|
- usage:
|
||||||
|
`bbolt version`
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$bbolt version
|
||||||
|
bbolt version: 1.3.7
|
||||||
|
Go Version: go1.20.7
|
||||||
|
Go OS/Arch: darwin/arm64
|
||||||
|
```
|
||||||
|
|
||||||
### info
|
### info
|
||||||
|
|
||||||
- `info` print the basic information about the given Bbolt database.
|
- `info` print the basic information about the given Bbolt database.
|
||||||
|
@ -17,6 +17,7 @@ func NewRootCommand() *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
|
newVersionCobraCommand(),
|
||||||
newSurgeryCobraCommand(),
|
newSurgeryCobraCommand(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
24
cmd/bbolt/command_version.go
Normal file
24
cmd/bbolt/command_version.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"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.Printf("bbolt Version: %s\n", version.Version)
|
||||||
|
fmt.Printf("Go Version: %s\n", runtime.Version())
|
||||||
|
fmt.Printf("Go OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return versionCmd
|
||||||
|
}
|
@ -156,6 +156,7 @@ Usage:
|
|||||||
|
|
||||||
The commands are:
|
The commands are:
|
||||||
|
|
||||||
|
version print the current version of bbolt
|
||||||
bench run synthetic benchmark against bbolt
|
bench run synthetic benchmark against bbolt
|
||||||
buckets print a list of buckets
|
buckets print a list of buckets
|
||||||
check verifies integrity of bbolt database
|
check verifies integrity of bbolt database
|
||||||
|
6
version/version.go
Normal file
6
version/version.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package version
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Version shows the last bbolt binary version released.
|
||||||
|
Version = "1.3.7"
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user