diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-02-10 08:27:36 -0600 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-02-10 08:27:36 -0600 |
| commit | 39c66558cfedfbb28b11c37cd43ef39adcbe1d26 (patch) | |
| tree | 08f308dde85066fee0ef1fd401c97cc76c449c5e /src/slskd/Common/Configuration/CommandLineConfigurationSource.cs | |
| parent | 324dd6bec3b40b69b2278bb93376bc1f90932bfa (diff) | |
| download | slskd-39c66558cfedfbb28b11c37cd43ef39adcbe1d26.tar.gz | |
more docs
Diffstat (limited to 'src/slskd/Common/Configuration/CommandLineConfigurationSource.cs')
| -rw-r--r-- | src/slskd/Common/Configuration/CommandLineConfigurationSource.cs | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/slskd/Common/Configuration/CommandLineConfigurationSource.cs b/src/slskd/Common/Configuration/CommandLineConfigurationSource.cs index 75ecadc4..088d5ea6 100644 --- a/src/slskd/Common/Configuration/CommandLineConfigurationSource.cs +++ b/src/slskd/Common/Configuration/CommandLineConfigurationSource.cs @@ -15,7 +15,6 @@ // along with this program. If not, see https://www.gnu.org/licenses/. // </copyright> -#pragma warning disable SA1649 // File name should match first type name namespace slskd.Configuration { using System; @@ -32,7 +31,7 @@ namespace slskd.Configuration /// <summary> /// Extension methods for adding <see cref="CommandLineConfigurationProvider"/>. /// </summary> - public static class CommandLineExtensions + public static class CommandLineConfigurationExtensions { /// <summary> /// Adds a command line argument configuration soruce to <paramref name="builder"/>. @@ -40,11 +39,8 @@ namespace slskd.Configuration /// <param name="builder">The <see cref="IConfigurationBuilder"/> to which to add.</param> /// <param name="map">A list of command line argument mappings.</param> /// <param name="commandLine">The command line string from which to parse arguments.</param> - /// <param name="normalizeKey"> - /// A value indicating whether configuration keys should be normalized (_, - removed, changed to lowercase). - /// </param> /// <returns>The updated <see cref="IConfigurationBuilder"/>.</returns> - public static IConfigurationBuilder AddCommandLine(this IConfigurationBuilder builder, IEnumerable<CommandLineArgument> map, string commandLine = null, bool normalizeKey = true) + public static IConfigurationBuilder AddCommandLine(this IConfigurationBuilder builder, IEnumerable<CommandLineArgument> map, string commandLine = null) { if (builder == null) { @@ -55,7 +51,6 @@ namespace slskd.Configuration { s.Map = map; s.CommandLine = commandLine ?? Environment.CommandLine; - s.NormalizeKey = normalizeKey; }); } @@ -82,12 +77,10 @@ namespace slskd.Configuration { Map = source.Map; CommandLine = source.CommandLine; - NormalizeKey = source.NormalizeKey; } private string CommandLine { get; set; } private IEnumerable<CommandLineArgument> Map { get; set; } - private bool NormalizeKey { get; set; } /// <summary> /// Parses command line arguments from the specified string and maps them to the specified keys. @@ -100,11 +93,6 @@ namespace slskd.Configuration { var (shortName, longName, type, key, _) = item; - if (NormalizeKey) - { - key = key?.Replace("-", string.Empty).Replace("_", string.Empty).ToLowerInvariant(); - } - if (string.IsNullOrEmpty(key)) { continue; @@ -146,16 +134,10 @@ namespace slskd.Configuration public IEnumerable<CommandLineArgument> Map { get; set; } /// <summary> - /// Gets or sets a value indicating whether configuration keys should be normalized (_, - removed, changed to lowercase). - /// </summary> - public bool NormalizeKey { get; set; } - - /// <summary> /// Builds the <see cref="CommandLineConfigurationProvider"/> for this source. /// </summary> /// <param name="builder">The <see cref="IConfigurationBuilder"/>.</param> /// <returns>A <see cref="CommandLineConfigurationProvider"/>.</returns> public IConfigurationProvider Build(IConfigurationBuilder builder) => new CommandLineConfigurationProvider(this); } -} -#pragma warning restore SA1649 // File name should match first type name
\ No newline at end of file +}
\ No newline at end of file |
