Added ability to initialze a modpack
This commit is contained in:
parent
5ad70e0a27
commit
20dddba0d5
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
/target
|
||||
.packium.toml
|
||||
|
15
src/pack.rs
15
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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user