-
Notifications
You must be signed in to change notification settings - Fork 646
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
command buckets converted to the cobra style #859
base: main
Are you sure you want to change the base?
Conversation
Hi @tommyshem. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Hi @tommyshem, thanks for your pull request. Could you please sign your commit? So the developer certificate of origin (DCO) check passes, i.e:
Thanks! Ref: https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#commit-your-change /ok-to-test |
Thanks for raising the PR. It doesn't break the user experience, so I agree to get this PR included in 1.4. Please resolve the test failure in case |
378390b
to
7dd48a6
Compare
cmd/bbolt/command_version.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the output so it could be tested in the future
cmd/bbolt/main_test.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the tests and put them in the buckets test file
Please signoff the commit, read https://github.com/etcd-io/bbolt/pull/859/checks?check_run_id=32833799850 |
d08fd3c
to
b89ce20
Compare
cmd/bbolt/bbolt.exe
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure how to delete this as upload by mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think running git rm cmd/bbolt/bbolt.exe
should work, as the file is not ignored. If it doesn't work, you can try adding -f
, i.e., git rm -f cmd/bbolt/bbolt.exe
.
You'll then need to do a commit.
Should be finished now for review. |
cmd/bbolt/command_version.go
Outdated
fmt.Fprintln(cmd.OutOrStdout(), "bbolt Version: ", version.Version) | ||
fmt.Fprintln(cmd.OutOrStdout(), "Go Version: ", runtime.Version()) | ||
fmt.Fprintln(cmd.OutOrStdout(), "Go OS/Arch: ", runtime.GOOS, "/", runtime.GOARCH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One PR only does one thing. Please don't make unrelated change.
b89ce20
to
a039306
Compare
Removed the bolt.exe file and the command_version.go file. |
cmd/bbolt/command_buckets_test.go
Outdated
} | ||
|
||
// executeCommand runs the given command and returns the output and error. | ||
func executeCommand(rootCmd *cobra.Command, args ...string) (*cobra.Command, string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just remove this function and get the implementation inlined in the test?
If you want to make it as a generic test utility function (i.e. included in utils_test.go), let's do it in a followup PR and we can discuss it separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have inline it as requested.
0c84aa2
to
4b3e3d4
Compare
All the changes from above should be done now. |
@tommyshem you need to rebase this PR instead of merging main branch into your dev branch. Please also squash the commits into one. |
Sorry new to github pull requests as only used github mainly for personal projects. I will try tomorrow to rebase and squash commits. Do I need to put any info in the commit text or just reference the issue number. |
Signed-off-by: tommy shem <tommy@test.com>
4b3e3d4
to
76ff28c
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tommyshem The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
if srcDBPath == "" { | ||
return ErrPathRequired |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the cobra.ExactArgs(1)
already guarantees that it won't be empty string? Pleasae follow the same pattern as other command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is from the original code.
// Print the list of buckets in the database. | ||
return db.View(func(tx *bolt.Tx) error { | ||
return tx.ForEach(func(name []byte, _ *bolt.Bucket) error { | ||
fmt.Fprintln(cmd.OutOrStdout(), string(name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that cmd.OutOrStdout()
is a little better than os.Stdout
, but please keep it consistent with other commands. We can replace them with cmd.OutOrStdout()
in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmd.OutOrStdout() is all ready used in the cobra style converted files already
command_check.go line 44, 65, 70
command_get.go line 46, 92
command_info.go line 47
command_version.go line 18, 19, 20
issue #472 Migrate all commands to cobra style commands
converted buckets command to cobra style