-
Notifications
You must be signed in to change notification settings - Fork 874
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: split cli roles edit command into create and update commands #17121
Conversation
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 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. ✅
cli/organizationroles.go
Outdated
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") |
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.
return xerrors.Errorf("the input appears to be an array, only 1 role can be sent at a time") | |
return xerrors.Errorf("only 1 role can be sent at a time") |
cli/organizationroles.go
Outdated
|
||
var customRole codersdk.Role | ||
if jsonInput { | ||
// JSON Upload mode |
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.
// JSON Upload mode |
I feel like the if
already gives about as much context as this comment
cli/organizationroles.go
Outdated
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]) |
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.
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]) | |
return xerrors.Errorf("The role %s does not exist. If you'd like to create this role use the create command instead", inv.Args[0]) |
cli/organizationroles.go
Outdated
} | ||
|
||
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) |
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.
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) | |
return xerrors.Errorf("The role %s does not exist. If you'd like to create this role use the create command instead", customRole.Name) |
Closes #14239