Library improvements (#126)

* Base impl

* Add grouping

* Fix some styling things

* Run linter

* add missing features

* add dev mode

---------

Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
Adrian O.V
2023-06-02 18:36:10 -04:00
committed by GitHub
parent 72fc215641
commit e0e9c3f166
15 changed files with 398 additions and 88 deletions

View File

@@ -27,6 +27,7 @@ thiserror = "1.0"
tokio-stream = { version = "0.1", features = ["fs"] }
futures = "0.3"
daedalus = {version = "0.1.15", features = ["bincode"] }
chrono = "0.4.26"
url = "2.2"
uuid = { version = "1.1", features = ["serde", "v4"] }

View File

@@ -195,6 +195,7 @@ pub struct EditProfileMetadata {
pub game_version: Option<String>,
pub loader: Option<ModLoader>,
pub loader_version: Option<LoaderVersion>,
pub groups: Option<Vec<String>>,
}
// Edits a profile
@@ -207,15 +208,19 @@ pub async fn profile_edit(
profile::edit(path, |prof| {
if let Some(metadata) = edit_profile.metadata.clone() {
if let Some(name) = metadata.name {
prof.metadata.name = name
prof.metadata.name = name;
}
if let Some(game_version) = metadata.game_version {
prof.metadata.game_version = game_version
prof.metadata.game_version = game_version;
}
if let Some(loader) = metadata.loader {
prof.metadata.loader = loader
prof.metadata.loader = loader;
}
prof.metadata.loader_version = metadata.loader_version;
if let Some(groups) = metadata.groups {
prof.metadata.groups = groups;
}
prof.metadata.loader_version = metadata.loader_version
}
prof.java = edit_profile.java.clone();
@@ -223,6 +228,8 @@ pub async fn profile_edit(
prof.resolution = edit_profile.resolution;
prof.hooks = edit_profile.hooks.clone();
prof.metadata.date_modified = chrono::Utc::now();
async { Ok(()) }
})
.await?;