Merge pull request #729 from ahrtr/update_surgery_cmd_20240417

Simplify the commands' usage description
pull/735/head
Benjamin Wang 2024-04-21 13:00:32 +01:00 committed by GitHub
commit 5ae7bc66ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 11 deletions

View File

@ -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 {

View File

@ -18,7 +18,7 @@ func NewRootCommand() *cobra.Command {
rootCmd.AddCommand(
newVersionCommand(),
newSurgeryCobraCommand(),
newSurgeryCommand(),
newInspectCommand(),
newCheckCommand(),
)

View File

@ -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",
@ -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 {
@ -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 {
@ -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 {
@ -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 {

View File

@ -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 {
@ -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 {

View File

@ -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 {
@ -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 {