Derive a JIRA-style intent prefix from a project directory name. Takes the first 4 alphanumeric characters and uppercases them. Examples: "pi-mono-rs" → "PIMO", "atomic" → "ATOM"
(project_name: &str)
| 221 | /// Takes the first 4 alphanumeric characters and uppercases them. |
| 222 | /// Examples: "pi-mono-rs" → "PIMO", "atomic" → "ATOM" |
| 223 | pub fn derive_intent_prefix(project_name: &str) -> String { |
| 224 | project_name |
| 225 | .chars() |
| 226 | .filter(|c| c.is_alphanumeric()) |
| 227 | .take(4) |
| 228 | .collect::<String>() |
| 229 | .to_uppercase() |
| 230 | } |
| 231 | |
| 232 | #[cfg(test)] |
| 233 | mod tests { |