mirror of
https://github.com/rmcrackan/Libation.git
synced 2025-12-23 22:17:52 -05:00
- 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
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using AppScaffolding;
|
|
using CommandLine;
|
|
using LibationFileManager;
|
|
using System;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
|
|
namespace LibationCli
|
|
{
|
|
public static class Setup
|
|
{
|
|
public static void Initialize()
|
|
{
|
|
//***********************************************//
|
|
// //
|
|
// do not use Configuration before this line //
|
|
// //
|
|
//***********************************************//
|
|
var config = LibationScaffolding.RunPreConfigMigrations();
|
|
|
|
if (!Directory.Exists(config.LibationFiles.Location))
|
|
{
|
|
Console.Error.WriteLine($"Cannot find LibationFiles at {config.LibationFiles.Location}");
|
|
PrintLibationFilestipAndExit();
|
|
}
|
|
|
|
if (!File.Exists(config.LibationFiles.SettingsFilePath))
|
|
{
|
|
Console.Error.WriteLine($"Cannot find settings files at {config.LibationFiles.SettingsFilePath}");
|
|
PrintLibationFilestipAndExit();
|
|
}
|
|
|
|
LibationScaffolding.RunPostConfigMigrations(config, ephemeralSettings: true);
|
|
|
|
#if classic
|
|
LibationScaffolding.RunPostMigrationScaffolding(Variety.Classic, config);
|
|
#else
|
|
LibationScaffolding.RunPostMigrationScaffolding(Variety.Chardonnay, config);
|
|
#endif
|
|
}
|
|
|
|
static void PrintLibationFilestipAndExit()
|
|
{
|
|
Console.Error.WriteLine($"Override LibationFiles directory location with '--libationFiles' option or '{LibationFiles.LIBATION_FILES_DIR}' environment variable.");
|
|
Environment.Exit(-1);
|
|
}
|
|
|
|
public static Type[] LoadVerbs() => Assembly.GetExecutingAssembly()
|
|
.GetTypes()
|
|
.Where(t => t.GetCustomAttribute<VerbAttribute>() is not null)
|
|
.ToArray();
|
|
}
|
|
}
|