Skip to content

Commit def830f

Browse files
committed
tabify
1 parent 9b63793 commit def830f

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

FluentCommandLineParser/Internals/Parsing/OptionParsers/CommandLineOptionParserFactory.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,20 @@ public ICommandLineOptionParser<T> CreateParser<T>()
8181
{
8282
var type = typeof(T);
8383

84-
if (!this.Parsers.ContainsKey(type))
85-
{
86-
if (! typeof(T).IsEnum)
87-
{
88-
throw new UnsupportedTypeException();
89-
}
84+
if (!this.Parsers.ContainsKey(type))
85+
{
86+
if (! typeof(T).IsEnum)
87+
{
88+
throw new UnsupportedTypeException();
89+
}
9090

91-
type = typeof(EnumCommandLineOptionParser<T>);
92-
if (!this.Parsers.ContainsKey(type))
93-
{
94-
this.AddOrReplace(new EnumCommandLineOptionParser<T>());
95-
}
96-
type = typeof(T);
97-
}
91+
type = typeof(EnumCommandLineOptionParser<T>);
92+
if (!this.Parsers.ContainsKey(type))
93+
{
94+
this.AddOrReplace(new EnumCommandLineOptionParser<T>());
95+
}
96+
type = typeof(T);
97+
}
9898

9999
return (ICommandLineOptionParser<T>)this.Parsers[type];
100100
}

FluentCommandLineParser/Internals/Parsing/OptionParsers/EnumCommandLineOptionParser.cs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,40 @@
2828

2929
namespace Fclp.Internals.Parsing.OptionParsers
3030
{
31-
/// <summary>
32-
/// Parser used to convert to <see cref="Enum"/>.
33-
/// </summary>
34-
/// <remarks>For <see cref="System.Boolean"/> types the value is optional. If no value is provided for the Option then <c>true</c> is returned.</remarks>
35-
public class EnumCommandLineOptionParser<T> : ICommandLineOptionParser<T>
36-
{
37-
/// <summary>
38-
/// Parses the specified <see cref="System.String"/> into a <see cref="System.Boolean"/>.
39-
/// </summary>
40-
/// <param name="parsedOption"></param>
41-
/// <returns>
42-
/// A <see cref="System.Boolean"/> representing the parsed value.
43-
/// The value is optional. If no value is provided then <c>true</c> is returned.
44-
/// </returns>
45-
public T Parse(ParsedOption parsedOption)
46-
{
47-
return (T)Enum.Parse(typeof(T), parsedOption.Value);
48-
}
31+
/// <summary>
32+
/// Parser used to convert to <see cref="Enum"/>.
33+
/// </summary>
34+
/// <remarks>For <see cref="System.Boolean"/> types the value is optional. If no value is provided for the Option then <c>true</c> is returned.</remarks>
35+
public class EnumCommandLineOptionParser<T> : ICommandLineOptionParser<T>
36+
{
37+
/// <summary>
38+
/// Parses the specified <see cref="System.String"/> into a <see cref="System.Boolean"/>.
39+
/// </summary>
40+
/// <param name="parsedOption"></param>
41+
/// <returns>
42+
/// A <see cref="System.Boolean"/> representing the parsed value.
43+
/// The value is optional. If no value is provided then <c>true</c> is returned.
44+
/// </returns>
45+
public T Parse(ParsedOption parsedOption)
46+
{
47+
return (T)Enum.Parse(typeof(T), parsedOption.Value);
48+
}
4949

50-
/// <summary>
51-
/// Determines whether the specified <see cref="System.String"/> can be parsed by this <see cref="ICommandLineOptionParser{T}"/>.
52-
/// </summary>
53-
/// <param name="parsedOption"></param>
54-
/// <returns><c>true</c> if the specified <see cref="System.String"/> can be parsed by this <see cref="ICommandLineOptionParser{T}"/>; otherwise <c>false</c>.</returns>
55-
public bool CanParse(ParsedOption parsedOption)
56-
{
57-
if (parsedOption.Value.IsNullOrWhiteSpace()) return false;
58-
if (parsedOption.HasValue == false) return false;
50+
/// <summary>
51+
/// Determines whether the specified <see cref="System.String"/> can be parsed by this <see cref="ICommandLineOptionParser{T}"/>.
52+
/// </summary>
53+
/// <param name="parsedOption"></param>
54+
/// <returns><c>true</c> if the specified <see cref="System.String"/> can be parsed by this <see cref="ICommandLineOptionParser{T}"/>; otherwise <c>false</c>.</returns>
55+
public bool CanParse(ParsedOption parsedOption)
56+
{
57+
if (parsedOption.Value.IsNullOrWhiteSpace()) return false;
58+
if (parsedOption.HasValue == false) return false;
5959

60-
string value = parsedOption.Value.Trim();
60+
string value = parsedOption.Value.Trim();
6161

62-
var items = value.SplitOnWhitespace();
62+
var items = value.SplitOnWhitespace();
6363

64-
return items.Count() == 1;
65-
}
66-
}
64+
return items.Count() == 1;
65+
}
66+
}
6767
}

0 commit comments

Comments
 (0)