Skip to content

chore: add edit organization role to cli #13365

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

Merged
merged 9 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup example
  • Loading branch information
Emyrk committed May 31, 2024
commit ce841f99cc43596eca66b18b2fa673300ddc552c
2 changes: 1 addition & 1 deletion cli/organizationroles.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (r *RootCmd) editOrganizationRole() *serpent.Command {
Long: FormatExamples(
Example{
Description: "Run with an input.json file",
Command: "coder roles edit custom_name < role.json",
Command: "coder roles edit --stdin < role.json",
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem to work with the output of organization roles show <orgname> -o json.

Copy link
Member Author

Choose a reason for hiding this comment

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

No it does not. Since that command outputs a slice [], and this takes a singular role. Maybe I should make it take a slice??

},
),
Options: []serpent.Option{
Expand Down
3 changes: 2 additions & 1 deletion enterprise/cli/organization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
func TestEditOrganizationRoles(t *testing.T) {
t.Parallel()

// Unit test uses --stdin and json as the role input. The interactive cli would
// be hard to drive from a unit test.
t.Run("JSON", func(t *testing.T) {
t.Parallel()

Expand All @@ -36,7 +38,6 @@ func TestEditOrganizationRoles(t *testing.T) {

ctx := testutil.Context(t, testutil.WaitMedium)
inv, root := clitest.New(t, "organization", "roles", "edit", "--stdin")
// Use json input, as interactive mode would be challenging to control
inv.Stdin = bytes.NewBufferString(fmt.Sprintf(`{
"name": "new-role",
"organization_id": "%s",
Expand Down