Files
coder/cli/testdata/coder_users_edit-roles_--help.golden
Nick Vigilante cf60604a75 feat!: confirm role changes in coder users edit-roles (#30140)
`coder users edit-roles --roles ...` replaces the user's whole set of
site roles, so granting one role could silently remove others, including
owner.
It registered `-y` but never prompted, and `-y` didn't skip the
interactive role picker.

It now prints the roles being added and removed and asks for
confirmation; `-y` skips it.
The `--roles` help says it replaces the full set.

**Behavior change:** **New prompt; can break scripts.** `edit-roles
--roles ...` without `-y` now prompts.
`-y` without `--roles` now fails with an error instead of opening the
picker.
If the requested roles match the current roles, it prints `No role
changes for <user>.` and doesn't prompt.

<details>
<summary>Decisions</summary>

- No-op requests skip the prompt so idempotent scripted calls stay
quiet.

</details>

Closes [CLI-21](https://linear.app/codercom/issue/CLI-21)

_This PR was generated by Coder Agents on behalf of @nickvigilante._
2026-09-30 12:36:30 -04:00

23 lines
567 B
Plaintext

coder v0.0.0-devel
USAGE:
coder users edit-roles [flags] <username|user_id>
Edit a user's roles by username or id
- --roles replaces the user's full set of site roles; any role not listed is
removed:
$ coder users edit-roles example_user --roles owner user-admin
OPTIONS:
--roles string-array
Replaces the user's full set of site roles with this list. Any
existing role not included here is removed.
-y, --yes bool
Bypass confirmation prompts.
———
Run `coder --help` for a list of global options.