mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-05-24 16:37:19 -04:00
Add license and settings overrides to LibationCli
- Add `LIBATION_FILES_DIR` environment variable to specify LibationFiles directory instead of appsettings.json - OptionsBase supports overriding setting - Added `EphemeralSettings` which are loaded from Settings.json once and can be modified with the `--override` command parameter - Added `get-setting` command - Prints (editable) settings and their values. Prints specified settings, or all settings if none specified - `--listEnumValues` option will list all names for a speficied enum-type settings. If no setting names are specified, prints all enum values for all enum settings. - Prints in a text-based table or bare with `-b` switch - Added `get-license` command which requests a content license and prints it as a json to stdout - Improved `liberate` command - Added `-force` option to force liberation without validation. - Added support to download with a license file supplied to stdin - Improve startup performance when downloading explicit ASIN(s) - Fix long-standing bug where cover art was not being downloading
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
|
||||
using FileManager;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
#nullable enable
|
||||
namespace LibationFileManager
|
||||
@@ -18,12 +19,15 @@ namespace LibationFileManager
|
||||
// default setting and directory creation occur in class responsible for files.
|
||||
// config class is only responsible for path. not responsible for setting defaults, dir validation, or dir creation
|
||||
// exceptions: appsettings.json, LibationFiles dir, Settings.json
|
||||
private IPersistentDictionary? persistentDictionary;
|
||||
private IPersistentDictionary Settings => persistentDictionary
|
||||
private IJsonBackedDictionary? JsonBackedDictionary { get; set; }
|
||||
private IJsonBackedDictionary Settings => JsonBackedDictionary
|
||||
?? throw new InvalidOperationException($"{nameof(LoadPersistentSettings)} must first be called prior to accessing {nameof(Settings)}");
|
||||
|
||||
internal void LoadPersistentSettings(string settingsFile)
|
||||
=> persistentDictionary = new PersistentDictionary(settingsFile);
|
||||
=> JsonBackedDictionary = new PersistentDictionary(settingsFile);
|
||||
|
||||
internal void LoadEphemeralSettings(JObject dataStore)
|
||||
=> JsonBackedDictionary = new EphemeralDictionary(dataStore);
|
||||
|
||||
private LibationFiles? _libationFiles;
|
||||
[Description("Location for storage of program-created files")]
|
||||
|
||||
Reference in New Issue
Block a user