diff --git a/.gitignore b/.gitignore
index ea8c4bf..91da6da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/target
+/test_packwiz
\ No newline at end of file
diff --git a/.idea/packwiz_modlist.iml b/.idea/packwiz_modlist.iml
index c254557..b0a39db 100644
--- a/.idea/packwiz_modlist.iml
+++ b/.idea/packwiz_modlist.iml
@@ -4,6 +4,7 @@
+
diff --git a/Cargo.lock b/Cargo.lock
index 4e04bf4..8041173 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -943,9 +943,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
-version = "1.17.0"
+version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
+checksum = "0f392c8f16bda3456c0b00c6de39cb100449b98de55ac41c6cdd2bfcf53a1245"
dependencies = [
"bytes",
"libc",
diff --git a/Cargo.toml b/Cargo.toml
index 32f0fcb..f5a73b2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
clap = { version = "^3.1", features = ["cargo", "derive"] }
toml = "^0.5"
-tokio = { version = "^1.17", features = ["full"] }
+tokio = { version = "^1.19", features = ["full"] }
futures = "^0.3"
thiserror = "^1.0"
colored = "^2.0"
diff --git a/src/object.rs b/src/object.rs
index 0d4e07f..db2aa35 100644
--- a/src/object.rs
+++ b/src/object.rs
@@ -24,18 +24,9 @@ pub struct PackMod {
pub name: String,
pub filename: String,
pub side: String,
- pub download: PackModDownload,
pub update: PackModUpdate,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct PackModDownload {
- pub url: String,
- #[serde(alias = "hash-format")]
- pub hash_format: String,
- pub hash: String,
-}
-
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PackModUpdate {
pub curseforge: Option,
@@ -99,8 +90,15 @@ impl From for Project {
impl Project {
pub fn url(&self) -> String {
match self {
- Project::CurseForge(CurseForgeProject { slug, .. }) => format!("https://www.curseforge.com/minecraft/mc-mods/{}", slug),
- Project::Modrinth(ModrinthProject { slug, .. }) => format!("https://modrinth.com/mod/{}", slug)
+ Project::CurseForge(CurseForgeProject { slug, .. }) => format!("https://www.curseforge.com/minecraft/mc-mods/{slug}"),
+ Project::Modrinth(ModrinthProject { id, .. }) => format!("https://modrinth.com/mod/{id}")
+ }
+ }
+
+ pub fn id(&self) -> String {
+ match self {
+ Project::CurseForge(CurseForgeProject { id, .. }) => id.to_string(),
+ Project::Modrinth(ModrinthProject { id, .. }) => id.clone()
}
}
diff --git a/src/output.rs b/src/output.rs
index f6bf809..0a71288 100644
--- a/src/output.rs
+++ b/src/output.rs
@@ -13,7 +13,9 @@ pub fn display_project(format: &str, project: &Project) -> String {
.replace("{DESCRIPTION}", &project.description())
.replace("{SUMMARY}", &project.description())
.replace("{URL}", &project.url())
+ .replace("{ID}", &project.id())
.replace("{SLUG}", &project.slug())
+ .replace("\\n", "\n")
}
pub async fn generate(args: &Args) -> GlobalResult {
@@ -29,9 +31,9 @@ pub async fn write_projects(args: &Args, data: &Data, writer: &mut W) -> Glob
for project in &data.projects {
let display = display_project(&args.format, project);
- info!("{}", &display);
+ info!("{display}");
- let display = format!("{}\n", display);
+ let display = format!("{display}\n");
writer.write_all(&display.into_bytes()).await?;
}