use anyhow::{Context, Result};
use std::path::Path;
#[derive(Debug, Clone)]
pub struct ProcfileEntry {
pub name: String,
pub command: String,
}
pub fn parse<P: AsRef<Path>>(path: P) -> Result<Vec<ProcfileEntry>> {
let content = std::fs::read_to_string(path).context("Failed to read Procfile")?;
let mut entries = Vec::new();
for line in content.lines() {
let line = line.trim();
if line.is_empty() || line.starts_with('#') {
continue;
}
if let Some((name, command)) = line.split_once(':') {
entries.push(ProcfileEntry {
name: name.trim().to_string(),
command: command.trim().to_string(),
});
}
}
Ok(entries)
}