Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the commands' usage description #729

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/bbolt/command_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func newInspectCommand() *cobra.Command {
inspectCmd := &cobra.Command{
Use: "inspect",
Use: "inspect <bbolt-file>",
Short: "inspect the structure of the database",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/bbolt/command_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func NewRootCommand() *cobra.Command {

rootCmd.AddCommand(
newVersionCommand(),
newSurgeryCobraCommand(),
newSurgeryCommand(),
ahrtr marked this conversation as resolved.
Show resolved Hide resolved
newInspectCommand(),
newCheckCommand(),
)
Expand Down
10 changes: 5 additions & 5 deletions cmd/bbolt/command_surgery.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
ErrSurgeryFreelistAlreadyExist = errors.New("the file already has freelist, please consider to abandon the freelist to forcibly rebuild it")
)

func newSurgeryCobraCommand() *cobra.Command {
func newSurgeryCommand() *cobra.Command {
surgeryCmd := &cobra.Command{
Use: "surgery <subcommand>",
Short: "surgery related commands",
Expand Down Expand Up @@ -52,7 +52,7 @@ func (o *surgeryBaseOptions) Validate() error {
func newSurgeryRevertMetaPageCommand() *cobra.Command {
var o surgeryBaseOptions
revertMetaPageCmd := &cobra.Command{
Use: "revert-meta-page <bbolt-file> [options]",
Use: "revert-meta-page <bbolt-file>",
Short: "Revert the meta page to revert the changes performed by the latest transaction",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -111,7 +111,7 @@ func (o *surgeryCopyPageOptions) Validate() error {
func newSurgeryCopyPageCommand() *cobra.Command {
var o surgeryCopyPageOptions
copyPageCmd := &cobra.Command{
Use: "copy-page <bbolt-file> [options]",
Use: "copy-page <bbolt-file>",
Short: "Copy page from the source page Id to the destination page Id",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -175,7 +175,7 @@ func (o *surgeryClearPageOptions) Validate() error {
func newSurgeryClearPageCommand() *cobra.Command {
var o surgeryClearPageOptions
clearPageCmd := &cobra.Command{
Use: "clear-page <bbolt-file> [options]",
Use: "clear-page <bbolt-file>",
Short: "Clears all elements from the given page, which can be a branch or leaf page",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -242,7 +242,7 @@ func (o *surgeryClearPageElementsOptions) Validate() error {
func newSurgeryClearPageElementsCommand() *cobra.Command {
var o surgeryClearPageElementsOptions
clearElementCmd := &cobra.Command{
Use: "clear-page-elements <bbolt-file> [options]",
Use: "clear-page-elements <bbolt-file>",
Short: "Clears elements from the given page, which can be a branch or leaf page",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
4 changes: 2 additions & 2 deletions cmd/bbolt/command_surgery_freelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func newSurgeryFreelistCommand() *cobra.Command {
func newSurgeryFreelistAbandonCommand() *cobra.Command {
var o surgeryBaseOptions
abandonFreelistCmd := &cobra.Command{
Use: "abandon <bbolt-file> [options]",
Use: "abandon <bbolt-file>",
Short: "Abandon the freelist from both meta pages",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -61,7 +61,7 @@ func surgeryFreelistAbandonFunc(srcDBPath string, cfg surgeryBaseOptions) error
func newSurgeryFreelistRebuildCommand() *cobra.Command {
var o surgeryBaseOptions
rebuildFreelistCmd := &cobra.Command{
Use: "rebuild <bbolt-file> [options]",
Use: "rebuild <bbolt-file>",
Short: "Rebuild the freelist",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
4 changes: 2 additions & 2 deletions cmd/bbolt/command_surgery_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func newSurgeryMetaCommand() *cobra.Command {

func newSurgeryMetaValidateCommand() *cobra.Command {
metaValidateCmd := &cobra.Command{
Use: "validate <bbolt-file> [options]",
Use: "validate <bbolt-file>",
Short: "Validate both meta pages",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -120,7 +120,7 @@ func (o *surgeryMetaUpdateOptions) Validate() error {
func newSurgeryMetaUpdateCommand() *cobra.Command {
var o surgeryMetaUpdateOptions
metaUpdateCmd := &cobra.Command{
Use: "update <bbolt-file> [options]",
Use: "update <bbolt-file>",
Short: "Update fields in meta pages",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
Loading