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

bbolt cli: Inspect command missing in cmd/bbolt/main.go #820

Closed
0x0000F1 opened this issue Aug 13, 2024 · 6 comments
Closed

bbolt cli: Inspect command missing in cmd/bbolt/main.go #820

0x0000F1 opened this issue Aug 13, 2024 · 6 comments

Comments

@0x0000F1
Copy link

was the inspect command in the cli removed on purpose? or is it just missing from main.go? because the command functionality exists in command_inspect.go it's just not added to the switch statement in main.go

@0x0000F1 0x0000F1 changed the title bbolt cli: Inspect command missing in main.go bbolt cli: Inspect command missing in cmd/bbolt/main.go Aug 13, 2024
@ahrtr
Copy link
Member

ahrtr commented Aug 13, 2024

See

newInspectCommand(),

@ahrtr ahrtr closed this as completed Aug 13, 2024
@0x0000F1
Copy link
Author

See

newInspectCommand(),

...

check cmd/bbolt/main.go

the command isn't registered there and so it's inaccessible bbolt cli throws uknown command if you try to use it

@ahrtr
Copy link
Member

ahrtr commented Aug 14, 2024

Read

bbolt/cmd/bbolt/main.go

Lines 65 to 73 in ee5b596

m := NewMain()
if err := m.Run(os.Args[1:]...); err == ErrUsage {
os.Exit(2)
} else if err == ErrUnknownCommand {
cobraExecute()
} else if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}

Also for some background, read #472

Also next time raise a question in https://github.com/etcd-io/bbolt/discussions if you have any confusion.

@0x0000F1
Copy link
Author

Read

bbolt/cmd/bbolt/main.go

Lines 65 to 73 in ee5b596

m := NewMain()
if err := m.Run(os.Args[1:]...); err == ErrUsage {
os.Exit(2)
} else if err == ErrUnknownCommand {
cobraExecute()
} else if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}

Also for some background, read #472

Also next time raise a question in https://github.com/etcd-io/bbolt/discussions if you have any confusion.

ok, can you point where in the run function is the inspect command?

func (m *Main) Run(args ...string) error {

try running the cli yourself instead maybe that should help you figure it out.

as the docs clearly state the command should work as described in the cli's readme

inspect

  • inspect inspect the structure of the database.
  • Usage: bbolt inspect [path to the bbolt database]

yet its is missing in the switch statement.

in the usage function also you can clearly see inspect command being listed

func (m *Main) Usage() string {

and here's a snippet of myself trying to run the command using the cli that was installed using the latest version

$ bbolt inspect my.db
unknown command

hope this makes it clearer, sorry for the inconvenience as from your response it seems that you weren't happy about this being brought to your attention.

and for your info I did check the other closed issues prior to making this one.

Have a nice day.

@0x0000F1
Copy link
Author

and just like I thought there's nothing about this on the discussions either :)

@ahrtr
Copy link
Member

ahrtr commented Aug 22, 2024

$ bbolt inspect my.db
unknown command

Execute commands below on main branch or put the bbolt into $PATH,

$ go build ./cmd/bbolt/
$ ./bbolt inspect my.db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants