From 20dddba0d5e72fa767d8f013e08761b0c9ef09cf Mon Sep 17 00:00:00 2001 From: xeovalyte Date: Tue, 28 May 2024 14:44:46 +0200 Subject: [PATCH] Added ability to initialze a modpack --- .gitignore | 1 + src/pack.rs | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ea8c4bf..897dd15 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +.packium.toml diff --git a/src/pack.rs b/src/pack.rs index f20ac30..83be6e0 100644 --- a/src/pack.rs +++ b/src/pack.rs @@ -12,12 +12,10 @@ pub struct Pack { #[derive(Serialize)] pub struct Info { loader: Modloader, - loader_version: String, minecraft_version: String, } #[derive(Serialize, Debug, Clone, Copy)] -#[serde(untagged)] pub enum Modloader { Fabric, Quilt, @@ -38,7 +36,7 @@ impl Display for Modloader { impl Pack { pub async fn init() { - println!("Fetching Minecraft information"); + println!("Fetching Minecraft information..."); let versions = modrinth::get_minecraft_versions().await.unwrap(); @@ -55,5 +53,16 @@ impl Pack { let version = Select::new("Minecraft version?", versions) .prompt() .unwrap(); + + let pack = Pack { + info: Info { + minecraft_version: version, + loader: modloader, + }, + }; + + let pack_toml = toml::to_string_pretty(&pack).unwrap(); + + std::fs::write(".packium.toml", pack_toml).unwrap(); } }