hd-cli 0.2.0

CLI binary for hyperdocker - the `hd` command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub fn run(path: &str) -> Result<(), Box<dyn std::error::Error>> {
    let content = std::fs::read_to_string(path)?;
    let spec = hd_oci::translate_dockerfile(&content)?;
    let toml = spec.to_toml()?;

    let out_path = "hd.toml";
    if std::path::Path::new(out_path).exists() {
        return Err("hd.toml already exists. Remove it first or use a different name.".into());
    }
    std::fs::write(out_path, &toml)?;
    println!("Translated {} -> hd.toml", path);
    println!("Review and customize the generated hd.toml");
    Ok(())
}