From 5d3b2eb8b524f9dc35d4f146540d429c171c3741 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Sat, 11 Sep 2021 18:19:23 +0200 Subject: [PATCH] modpack ID is now kebab-case version of name --- CHANGELOG.md | 1 + mpt/Cargo.toml | 1 + mpt/src/commands/import.rs | 4 ++-- mpt/src/commands/init.rs | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84c3b00..e630c98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ # 0.1.2 - optimize curseforge relation meta querying - add debug logging +- import and init now set the modpack's ID to a kebab-case version of the name diff --git a/mpt/Cargo.toml b/mpt/Cargo.toml index 7363fa6..a05852c 100644 --- a/mpt/Cargo.toml +++ b/mpt/Cargo.toml @@ -15,6 +15,7 @@ anyhow = "1.0.43" async-trait = "0.1.51" crossterm = "0.21.0" futures = "0.3.16" +heck = "0.3.3" indicatif = "0.16.2" json5 = "0.3.0" log = "0.4.14" diff --git a/mpt/src/commands/import.rs b/mpt/src/commands/import.rs index 3e2e6ae..9a331a5 100644 --- a/mpt/src/commands/import.rs +++ b/mpt/src/commands/import.rs @@ -17,6 +17,7 @@ use addonscript::{ }; use anyhow::{bail, Context}; use crossterm::style::Stylize; +use heck::KebabCase; use log::info; use twitch::manifest::Manifest as TwManifest; use url::Url; @@ -85,8 +86,7 @@ pub async fn run(config: Config, infile: PathBuf) -> anyhow::Result<()> { } let manif = Manifest { - // TODO convert to snake_case - id: data.name.clone(), + id: data.name.to_kebab_case(), manifest_type: ManifestType::Modpack, versions: vec![Version { mcversion: vec![data.minecraft.version], diff --git a/mpt/src/commands/init.rs b/mpt/src/commands/init.rs index a954735..93c7693 100644 --- a/mpt/src/commands/init.rs +++ b/mpt/src/commands/init.rs @@ -31,6 +31,7 @@ use crossterm::{ }, ExecutableCommand, }; +use heck::KebabCase; use reqwest::Client; use std::path::Path; use url::Url; @@ -147,8 +148,7 @@ pub async fn run( tokio::fs::create_dir_all(path.join("overrides")).await?; let data = serde_json::to_vec_pretty(&Manifest { - // TODO rename this to snake_case - id: modpack_name.clone(), + id: modpack_name.to_kebab_case(), manifest_type: ManifestType::Modpack, versions: vec![Version { version: "1.0".into(),