MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / subject_label

Function subject_label

atomic-cli/src/commands/workspace/grant.rs:342–356  ·  view source on GitHub ↗

Build a human-readable label for the subject, used in success messages.

(
    subject_type: atomic_teams::GrantSubjectType,
    team_slug: &Option<String>,
    user_id: &Option<String>,
)

Source from the content-addressed store, hash-verified

340
341/// Build a human-readable label for the subject, used in success messages.
342fn subject_label(
343 subject_type: atomic_teams::GrantSubjectType,
344 team_slug: &Option<String>,
345 user_id: &Option<String>,
346) -> String {
347 match subject_type {
348 atomic_teams::GrantSubjectType::Team => {
349 format!("team '{}'", team_slug.as_deref().unwrap_or("?"))
350 }
351 atomic_teams::GrantSubjectType::User => {
352 format!("user {}", user_id.as_deref().unwrap_or("?"))
353 }
354 atomic_teams::GrantSubjectType::Everyone => "everyone".to_string(),
355 }
356}
357
358#[cfg(test)]
359mod tests {

Callers 3

subject_label_teamFunction · 0.85
subject_label_userFunction · 0.85
subject_label_everyoneFunction · 0.85

Calls

no outgoing calls

Tested by 3

subject_label_teamFunction · 0.68
subject_label_userFunction · 0.68
subject_label_everyoneFunction · 0.68