Derive an intent prefix from a project directory name. Takes the first 4 alphanumeric characters and uppercases them. Examples: "pi-mono-rs" → "PIMO", "atomic" → "ATOM", "my-app" → "MYAP"
(project_name: &str)
| 357 | /// Takes the first 4 alphanumeric characters and uppercases them. |
| 358 | /// Examples: "pi-mono-rs" → "PIMO", "atomic" → "ATOM", "my-app" → "MYAP" |
| 359 | pub fn derive_intent_prefix(project_name: &str) -> String { |
| 360 | project_name |
| 361 | .chars() |
| 362 | .filter(|c| c.is_alphanumeric()) |
| 363 | .take(4) |
| 364 | .collect::<String>() |
| 365 | .to_uppercase() |
| 366 | } |
| 367 | |
| 368 | /// Get the next intent ID and advance the counter. |
| 369 | /// Returns a string like "PIMO-1", "ATOM-42". |
nothing calls this directly
no outgoing calls
no test coverage detected