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

split lakectl cmds - part 2 #6272

Merged
merged 3 commits into from
Aug 1, 2023
Merged

Conversation

nopcoder
Copy link
Contributor

part2 - end result will be based on #6254

@github-actions
Copy link

No linked issues found. Please add the corresponding issues in the pull request description.
Use GitHub automation to close the issue when a PR is merged

@nopcoder nopcoder requested a review from N-o-Z July 27, 2023 18:29
@nopcoder nopcoder added exclude-changelog PR description should not be included in next release changelog minor-change Used for PRs that don't require issue attached labels Jul 27, 2023
@nopcoder nopcoder self-assigned this Jul 28, 2023
@nopcoder nopcoder force-pushed the chore/ctl-org-part2 branch 4 times, most recently from 8015318 to 36207c6 Compare July 30, 2023 11:00
Copy link
Member

@N-o-Z N-o-Z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review

@@ -146,15 +147,15 @@ var tagShowCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
client := getClient()
u := MustParseRefURI("tag", args[0])
Fmt("Tag ref: %s\n", u.String())
fmt.Printf("Tag ref: %s\n", u.String())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Tag ref: %s\n", u.String())
fmt.Printf("Tag ref: %s\n", u)

@@ -130,7 +131,7 @@ var tagDeleteCmd = &cobra.Command{
}
client := getClient()
u := MustParseRefURI("tag", args[0])
Fmt("Tag ref: %s\n", u.String())
fmt.Printf("Tag ref: %s\n", u.String())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Tag ref: %s\n", u.String())
fmt.Printf("Tag ref: %s\n", u)

@@ -83,7 +84,7 @@ var ingestCmd = &cobra.Command{
}
err = walker.Walk(ctx, block.WalkOptions{}, func(e block.ObjectStoreEntry) error {
if dryRun {
Fmt("%s\n", e)
fmt.Printf("%s\n", e)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("%s\n", e)
fmt.Println("%s", e)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't use %s with Println - I've just passed e

@@ -54,15 +54,15 @@ var diffCmd = &cobra.Command{
if len(args) == diffCmdMinArgs {
// got one arg ref: uncommitted changes diff
branchURI := MustParseRefURI("ref", args[0])
Fmt("Ref: %s\n", branchURI.String())
fmt.Printf("Ref: %s\n", branchURI)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Ref: %s\n", branchURI)
fmt.Println("Ref: %s", branchURI)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kept Printf to use %s - we can drop the formatting and switch to use Println, but it is pretty equal.

@@ -55,7 +56,7 @@ var commitCmd = &cobra.Command{
}

branchURI := MustParseRefURI("branch", args[0])
Fmt("Branch: %s\n", branchURI.String())
fmt.Printf("Branch: %s\n", branchURI)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Branch: %s\n", branchURI)
fmt.Println("Branch: %s", branchURI)

@@ -116,7 +116,7 @@ var branchRevertCmd = &cobra.Command{
},
Run: func(cmd *cobra.Command, args []string) {
u := MustParseBranchURI("branch", args[0])
Fmt("Branch: %s\n", u.String())
fmt.Printf("Branch: %s\n", u.String())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Branch: %s\n", u.String())
fmt.Println("Branch: %s\n", u)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kept the format and dropped the call to String()

@@ -135,7 +135,7 @@ var branchRevertCmd = &cobra.Command{
Ref: commitRef,
})
DieOnErrorOrUnexpectedStatusCode(resp, err, http.StatusNoContent)
Fmt("commit %s successfully reverted\n", commitRef)
fmt.Printf("commit %s successfully reverted\n", commitRef)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("commit %s successfully reverted\n", commitRef)
fmt.Println("commit %s successfully reverted", commitRef)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kept the original

@@ -154,7 +154,7 @@ var branchResetCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
clt := getClient()
u := MustParseBranchURI("branch", args[0])
Fmt("Branch: %s\n", u.String())
fmt.Printf("Branch: %s\n", u.String())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Branch: %s\n", u.String())
fmt.Println("Branch: %s", u)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kept the original format and dropped the call to String()

@@ -205,14 +205,14 @@ var branchShowCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
client := getClient()
u := MustParseBranchURI("branch", args[0])
Fmt("Branch: %s\n", u.String())
fmt.Printf("Branch: %s\n", u.String())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Branch: %s\n", u.String())
fmt.Println("Branch: %s", u)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kept Printf and dropped the call to String()

resp, err := client.GetBranchWithResponse(cmd.Context(), u.Repository, u.Ref)
DieOnErrorOrUnexpectedStatusCode(resp, err, http.StatusOK)
if resp.JSON200 == nil {
Die("Bad response from server", 1)
}
branch := resp.JSON200
Fmt("Commit ID: %s\n", branch.CommitId)
fmt.Printf("Commit ID: %s\n", branch.CommitId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Commit ID: %s\n", branch.CommitId)
fmt.Println("Commit ID: %s", branch.CommitId)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kept the original

@nopcoder
Copy link
Contributor Author

@N-o-Z addressed all the comments some of them are part of the next PR.

Copy link
Member

@N-o-Z N-o-Z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nopcoder Thanks!
One comment regarding file naming

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename to auth_groups_members_list, this way it will sit lexicographically with the members sub command in the file tree

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename to auth_groups_members_remove, this way it will sit lexicographically with the members sub command in the file tree

* lakectl cmd split part 2b

* split lakectl cmds - part 3 (#6277)

* lakectl cmd part 2

* lakectl cmd split part 3

* update cli docs

* use Println instead of Printf when possible
@nopcoder nopcoder merged commit 74a53d8 into chore/ctl-org-part1 Aug 1, 2023
14 checks passed
@nopcoder nopcoder deleted the chore/ctl-org-part2 branch August 1, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude-changelog PR description should not be included in next release changelog minor-change Used for PRs that don't require issue attached
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants