init now creates overrides dir and gitignore
This commit is contained in:
parent
f4e2694e43
commit
d95755b194
1 changed files with 22 additions and 1 deletions
|
@ -38,6 +38,10 @@ use url::Url;
|
|||
use crate::config::Config;
|
||||
|
||||
const DEFAULT_CONFIG: &[u8] = include_bytes!("../../assets/modpacktoolsconfig.toml");
|
||||
const DEFAULT_GITIGNORE: &str = "\
|
||||
build/
|
||||
.mpt/
|
||||
";
|
||||
|
||||
pub async fn run(
|
||||
modpack_name: String,
|
||||
|
@ -139,7 +143,8 @@ pub async fn run(
|
|||
)?;
|
||||
}
|
||||
|
||||
tokio::fs::create_dir_all(path).await?;
|
||||
// also create overrides
|
||||
tokio::fs::create_dir_all(path.join("overrides")).await?;
|
||||
|
||||
let data = serde_json::to_vec_pretty(&Manifest {
|
||||
// TODO rename this to snake_case
|
||||
|
@ -182,5 +187,21 @@ pub async fn run(
|
|||
))?;
|
||||
}
|
||||
|
||||
if Path::new(".gitignore").exists() {
|
||||
stdout.execute(PrintStyledContent(
|
||||
".gitignore exists, skipping...\n"
|
||||
.with(Color::Red)
|
||||
.attribute(Attribute::Italic),
|
||||
))?;
|
||||
} else {
|
||||
tokio::fs::write(".gitignore", DEFAULT_GITIGNORE).await?;
|
||||
|
||||
stdout.execute(PrintStyledContent(
|
||||
"Created .gitignore!\n"
|
||||
.with(Color::Green)
|
||||
.attribute(Attribute::Bold),
|
||||
))?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue