Actually save userdata after using the profile remove command

This commit is contained in:
Warren Hood 2024-10-09 01:57:30 +02:00
parent e6b4eff11e
commit 8cd758aa96
2 changed files with 5 additions and 1 deletions

View file

@ -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) 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 - [ ] Test the merge apply policies when I am not half asleep
- [ ] Show package version somewhere in `mmm` - [ ] Show package version somewhere in `mmm`
- [X] Save userdata after removing profiles with the remove command
### Nice to haves ### Nice to haves

View file

@ -6,7 +6,7 @@ mod profiles;
mod providers; mod providers;
mod resolver; mod resolver;
use anyhow::{Error, Result}; use anyhow::{Context, Error, Result};
use clap::{Args, Parser, Subcommand}; use clap::{Args, Parser, Subcommand};
use file_meta::{get_normalized_relative_path, FileApplyPolicy, FileMeta}; use file_meta::{get_normalized_relative_path, FileApplyPolicy, FileMeta};
use mod_meta::{ModMeta, ModProvider}; use mod_meta::{ModMeta, ModProvider};
@ -507,6 +507,9 @@ async fn main() -> anyhow::Result<()> {
ProfileCommands::Remove { name } => { ProfileCommands::Remove { name } => {
let mut userdata = profiles::Data::load()?; let mut userdata = profiles::Data::load()?;
userdata.remove_profile(&name); userdata.remove_profile(&name);
userdata.save().with_context(|| {
format!("Failed to save userdata after removing profile {name}")
})?;
println!("Removed profile '{name}'"); println!("Removed profile '{name}'");
} }
ProfileCommands::Show { name } => { ProfileCommands::Show { name } => {