pub fn init(dir: PathBuf, opts: &InitOpts) -> Result<i32, InitError> {
    // Create the basic directory structure (this will create both `src/` and
    // `src/templates/`)
    fs::create_dir_all(dir.join("src/templates"))
        .map_err(|err| InitError::CreateDirStructureFailed { source: err })?;
    fs::create_dir_all(dir.join(".cargo"))
        .map_err(|err| InitError::CreateDirStructureFailed { source: err })?;
    // Now create each file
    create_file_if_not_present(&dir.join("Cargo.toml"), DFLT_INIT_CARGO_TOML, &opts.name)?;
    create_file_if_not_present(&dir.join(".gitignore"), DFLT_INIT_GITIGNORE, &opts.name)?;
    create_file_if_not_present(&dir.join("src/main.rs"), DFLT_INIT_MAIN_RS, &opts.name)?;
    create_file_if_not_present(
        &dir.join("src/templates/mod.rs"),
        DFLT_INIT_MOD_RS,
        &opts.name,
    )?;
    create_file_if_not_present(
        &dir.join("src/templates/index.rs"),
        DFLT_INIT_INDEX_RS,
        &opts.name,
    )?;
    create_file_if_not_present(
        &dir.join(".cargo/config.toml"),
        DFLT_INIT_CONFIG_TOML,
        // Not used in this one
        &opts.name,
    )?;

    // And now tell the user about some stuff
    println!("Your new app has been created! Run `perseus serve -w` to get to work! You can find more details, including about improving compilation speeds in the Perseus docs (https://framesurge.sh/perseus/en-US/docs/).");

    Ok(0)
}
Initializes a new Perseus project in the given directory, based on either
the default template or one from a given URL.
packages/perseus-cli/src/init.rs