From e9108aa3e747cd5798a4768e7cf9c5aa65d53395 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 23 Jan 2021 13:40:07 -0600 Subject: move Configuration --- src/slskd/Configuration.cs | 214 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 src/slskd/Configuration.cs (limited to 'src/slskd/Configuration.cs') diff --git a/src/slskd/Configuration.cs b/src/slskd/Configuration.cs new file mode 100644 index 00000000..da7ccf48 --- /dev/null +++ b/src/slskd/Configuration.cs @@ -0,0 +1,214 @@ +namespace slskd +{ + using System; + using System.Collections.Generic; + + public record Option(char ShortName, string LongName, string EnvironmentVariable, Type Type, string Key, string Description = null); + + public static class Configuration + { + public static EnvironmentVariable ToEnvironmentVariable(this Option option) + => new EnvironmentVariable(option.EnvironmentVariable, option.Type, option.Key, option.Description); + + public static CommandLineArgument ToCommandLineArgument(this Option option) + => new CommandLineArgument(option.ShortName, option.LongName, option.Type, option.Key, option.Description); + + public static IEnumerable