use std::path::Path;
pub fn portable_relative_path(root_directory: &Path, path: &Path) -> String {
let relative = path.strip_prefix(root_directory).unwrap_or(path);
relative
.components()
.map(|component| component.as_os_str().to_string_lossy().into_owned())
.collect::<Vec<_>>()
.join("/")
}
pub fn escape_github_workflow_message(message: &str) -> String {
message
.replace('%', "%25")
.replace('\r', "%0D")
.replace('\n', "%0A")
.replace(':', "%3A")
.replace(',', "%2C")
}
pub fn pluralized(count: usize, noun: &str) -> String {
if count == 1 {
format!("1 {noun}")
} else {
format!("{count} {noun}s")
}
}