Parse the user-facing `--permission` flag into a `GrantRelation`. Workspace grants only accept `read`, `write`, and `admin` — `owner` is an org-level relation and is rejected here.
(s: &str)
| 325 | /// Workspace grants only accept `read`, `write`, and `admin` — `owner` is an |
| 326 | /// org-level relation and is rejected here. |
| 327 | fn parse_permission(s: &str) -> CliResult<atomic_teams::GrantRelation> { |
| 328 | match s.to_lowercase().as_str() { |
| 329 | "read" => Ok(atomic_teams::GrantRelation::Read), |
| 330 | "write" => Ok(atomic_teams::GrantRelation::Write), |
| 331 | "admin" => Ok(atomic_teams::GrantRelation::Admin), |
| 332 | other => Err(CliError::InvalidArgument { |
| 333 | message: format!( |
| 334 | "Invalid permission '{other}'.\n \ |
| 335 | Valid values: read, write, admin." |
| 336 | ), |
| 337 | }), |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | /// Build a human-readable label for the subject, used in success messages. |
| 342 | fn subject_label( |