Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: split cli roles edit command into create and update commands#17121

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

brettkolodny
Copy link
Contributor

@brettkolodnybrettkolodny commentedMar 26, 2025
edited
Loading

Closes#14239

@brettkolodnybrettkolodny changed the titleBrett 14239/refactor cli roles edit commandfeat: refactor the cli roles edit command into a create and update commandMar 26, 2025
@brettkolodnybrettkolodny marked this pull request as ready for reviewApril 1, 2025 18:54
@brettkolodnybrettkolodny changed the titlefeat: refactor the cli roles edit command into a create and update commandfeat: split cli roles edit command into create and update commandsApr 1, 2025
Copy link
Member

@aslilacaslilac left a comment

Choose a reason for hiding this comment

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

I am not really knowledgable about this part of the codebase, but more knowledgable minds seem to be forfeiting their review jurisdiction. You added some tests, and the code seems coherent enough to me. ✅

arr := make([]json.RawMessage, 0)
err = json.Unmarshal(bytes, &arr)
if err == nil && len(arr) > 0 {
return xerrors.Errorf("the input appears to be an array, only 1 role can be sent at a time")
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
returnxerrors.Errorf("the input appears to be an array,only 1 role can be sent at a time")
returnxerrors.Errorf("only 1 role can be sent at a time")


var customRole codersdk.Role
if jsonInput {
// JSON Upload mode
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
// JSON Upload mode

I feel like theif already gives about as much context as this comment

interactiveRole, newRole, err := interactiveOrgRoleEdit(inv, org.ID, client)
role := existingRole(inv.Args[0], existingRoles)
if role == nil {
return xerrors.Errorf("The role %s does not exist exists. If you'd like to create this role use the create command instead", inv.Args[0])
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
returnxerrors.Errorf("The role %s does not exist exists. If you'd like to create this role use the create command instead",inv.Args[0])
returnxerrors.Errorf("The role %s does not exist. If you'd like to create this role use the create command instead",inv.Args[0])

}

if role := existingRole(customRole.Name, existingRoles); role == nil {
return xerrors.Errorf("The role %s does not exist exists. If you'd like to create this role use the create command instead", customRole.Name)
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
returnxerrors.Errorf("The role %s does not exist exists. If you'd like to create this role use the create command instead",customRole.Name)
returnxerrors.Errorf("The role %s does not exist. If you'd like to create this role use the create command instead",customRole.Name)

@brettkolodnybrettkolodny merged commitae7afd1 intomainApr 4, 2025
31 checks passed
@brettkolodnybrettkolodny deleted the brett-14239/refactor-cli-roles-edit-command branchApril 4, 2025 18:04
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsApr 4, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@aslilacaslilacAwaiting requested review from aslilac

Assignees

@brettkolodnybrettkolodny

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Refactor cli editing custom roles to use create/update vs a singular edit
2 participants
@brettkolodny@aslilac

[8]ページ先頭

©2009-2025 Movatter.jp