use crate::commands::{cmd, mkdir, touch};
use crate::ANSWER_FOLDER;
use std::error::Error;
const GITIGNORE: &str = "
# Eric Wastl wishes for users not to share their puzzle input
/inputs/*
/input_examples/*
# Generated by Cargo
# will have compiled files and executables
/target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
";
pub fn init() -> Result<(), Box<dyn Error>> {
cmd("cargo", &["init"]);
cmd("cargo", &["add", "aors"]);
mkdir("inputs");
mkdir("input_examples");
mkdir(ANSWER_FOLDER);
mkdir("src/bin/helpers");
touch(
"src/bin/helpers/mod.rs",
"#[allow(dead_code)]",
"failed to create helpers module",
);
touch(".gitignore", GITIGNORE, "failed to create .gitignore");
Ok(())
}