- Notifications
You must be signed in to change notification settings - Fork907
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
Uh oh!
There was an error while loading.Please reload this page.
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.
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") |
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 theif
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.
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]) |
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.
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) |
ae7afd1
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Closes#14239