fn new_internal(name: &str) -> Result<(), Box<dyn Error>> {
    if !PathBuf::from(name).exists() {
        fs::create_dir_all(&format!("{}/{}", name, name.replace("-", "_")))?;
        fs::File::create(&format!("{}/{}/__init__.py", name, name.replace("-", "_")))?;
        fs::File::create(&format!("{}/README.md", name))?;
        fs::File::create(&format!("{}/.gitignore", name))?;
    }

    let readme_init = &format!("# {}\n\n{}", name, "(A description)");

    fs::write(&format!("{}/.gitignore", name), GITIGNORE_INIT)?;
    fs::write(&format!("{}/README.md", name), readme_init)?;

    let cfg = Config {
        name: Some(name.to_string()),
        authors: util::get_git_author(),
        py_version: Some(util::prompts::py_vers()),
        ..Default::default()
    };

    cfg.write_file(&PathBuf::from(format!("{}/pyproject.toml", name)));

    if commands::git_init(Path::new(name)).is_err() {
        util::print_color(
            "Unable to initialize a git repo for your project",
            Color::Yellow, // Dark
        );
    };

    Ok(())
}
// TODO: Join this function after refactoring
/// Create a template directory for a python project.
Join this function after refactoring
Create a template directory for a python project.
Join this function after refactoring Create a template directory for a python project .
fn new_internal(name: &str) -> Result<(), Box<dyn Error>> {
    if !PathBuf::from(name).exists() {
        fs::create_dir_all(&format!("{}/{}", name, name.replace("-", "_")))?;
        fs::File::create(&format!("{}/{}/__init__.py", name, name.replace("-", "_")))?;
        fs::File::create(&format!("{}/README.md", name))?;
        fs::File::create(&format!("{}/.gitignore", name))?;
    }
    let readme_init = &format!("# {}\n\n{}", name, "(A description)");
    fs::write(&format!("{}/.gitignore", name), GITIGNORE_INIT)?;
    fs::write(&format!("{}/README.md", name), readme_init)?;
    let cfg = Config {
        name: Some(name.to_string()),
        authors: util::get_git_author(),
        py_version: Some(util::prompts::py_vers()),
        ..Default::default()
    };
    cfg.write_file(&PathBuf::from(format!("{}/pyproject.toml", name)));
    if commands::git_init(Path::new(name)).is_err() {
        util::print_color(
            "Unable to initialize a git repo for your project",
            Color::Yellow, // Dark
        );
    };
    Ok(())
}
fn new_internal ( name : & str ) -> Result < ( ) , Box < dyn Error > > { if ! PathBuf :: from ( name ) . exists ( ) { fs :: create_dir_all ( & format ! ( " " name name replace ( " " " " ) ) ) ? ; fs :: File :: create ( & format ! ( " " name name replace ( " " " " ) ) ) ? ; fs :: File :: create ( & format ! ( " " name ) ) ? ; fs :: File :: create ( & format ! ( " " name ) ) ? ; } let readme_init = & format ! ( " \n \n " name " " ) ; fs :: write ( & format ! ( " " name ) , GITIGNORE_INIT ) ? ; fs :: write ( & format ! ( " " name ) , readme_init ) ? ; let cfg = Config { name : Some ( name . to_string ( ) ) , authors : util :: get_git_author ( ) , py_version : Some ( util :: prompts :: py_vers ( ) ) , .. Default :: default ( ) } ; cfg . write_file ( & PathBuf :: from ( format ! ( " " name ) ) ) ; if commands :: git_init ( Path :: new ( name ) ) . is_err ( ) { util :: print_color ( " " , Color :: Yellow , // Dark ) ; } ; Ok ( ( ) ) }
TODO: Join this function after refactoring
Create a template directory for a python project.
TODO : Join this function after refactoring Create a template directory for a python project .
name
&str
name
&str