From 8cd758aa96931da6528363ff92b0a20d6f20ac57 Mon Sep 17 00:00:00 2001 From: Warren Hood Date: Wed, 9 Oct 2024 01:57:30 +0200 Subject: [PATCH] Actually save userdata after using the profile remove command --- TODO.md | 1 + mcmpmgr/src/main.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 66bc885..a873a91 100644 --- a/TODO.md +++ b/TODO.md @@ -18,6 +18,7 @@ This is a rather unorganised list of TODOs just so I can somewhat keep track of merge (retaining original/modified values) merge should result in an install dir with A and B, where a.json and b.json are in A, and a.json is the result of merging a.json into the installed a.json (retaining the existing values from the file in the install dir), and the original files in folder B untouched (x.json and y.json) - [ ] Test the merge apply policies when I am not half asleep - [ ] Show package version somewhere in `mmm` +- [X] Save userdata after removing profiles with the remove command ### Nice to haves diff --git a/mcmpmgr/src/main.rs b/mcmpmgr/src/main.rs index 80a3717..54b0d1d 100644 --- a/mcmpmgr/src/main.rs +++ b/mcmpmgr/src/main.rs @@ -6,7 +6,7 @@ mod profiles; mod providers; mod resolver; -use anyhow::{Error, Result}; +use anyhow::{Context, Error, Result}; use clap::{Args, Parser, Subcommand}; use file_meta::{get_normalized_relative_path, FileApplyPolicy, FileMeta}; use mod_meta::{ModMeta, ModProvider}; @@ -507,6 +507,9 @@ async fn main() -> anyhow::Result<()> { ProfileCommands::Remove { name } => { let mut userdata = profiles::Data::load()?; userdata.remove_profile(&name); + userdata.save().with_context(|| { + format!("Failed to save userdata after removing profile {name}") + })?; println!("Removed profile '{name}'"); } ProfileCommands::Show { name } => {