Save selections when marking packages to install so that refreshing the cache doesn't remove the user's selections.
This could be stored in a yaml file. Something like this maybe:
-Package
- PkgId: (id)
- Version: (marked version)
- Action: (selected action)
If the user chooses to "Do nothing", the package's entry will be removed from the list. Could be useful to create a command-line application for this, one with the following example commands:
cli-guinget-mark.exe --action "Install" --pkgid "7zip.7zip" --version "19.0.0". The "Do nothing" action would be "Unmark".
If the user refreshes the cache or accidentally closes guinget, we'll load their selections from this file. As it is, refreshing the cache de-selects any package that's been marked for changes, and that's not really good.
Got this idea from apt-mark, though I don't really know how apt-mark works with regards to marking packages.
There should be an argument named --delete-marked-list which deletes the marked package list, and another that adds to it, maybe named --edit-marked-list
Maybe this should default to saving the marked list right before refreshing the cache, then re-loading it right after (or, preferably, as we're filling the list). There could be another mode to never cache selections and a mode to cache selections after every marking action.
Reloading selections after re-opening the program might not be a good idea. The user would have to select all and unmark them, then do something that would clear the selection list cache so their new choices are reflected. Maybe that would require saving selections on exit instead of on refresh. The reason why loading selections on startup may not work well with saving and loading on refresh is due to no packages being listed at startup, which conflicts.
If it's set to save and reload on refresh, deleting the cache file on exit may be a good option to add, with a button to clear it right away if the user wants to. It'll still be deleted and re-created on refresh, though.
Editing the file may work better for the option to change it whenever any packages are marked.
Instead of saving and re-loading selections in the code that refreshes the cache, maybe do that in the code that runs when you click the "Refresh" button and only have it run if there are packages in the list. That way, any settings changes that require restarting the app can allow the user to save the selections list and reload them on startup, even if the user has the list thing set to save and reload on refresh.
Saving and reloading on restart should also have a Boolean arg that says whether it should delete the selections file on app exit or not, allowing certain code to bypass a "delete selections on exit" setting. There should also be an option that specifies whether the selections should be saved on exit in case the app needs to be restarted. This setting can have a checkbox in the messagebox (in addition to the Options window) that asks the user if they want to restart the app right now so the new settings can take effect.