diff --git a/ArgsUniform/ArgsUniform.cs b/ArgsUniform/ArgsUniform.cs index 88e539a..1cb0792 100644 --- a/ArgsUniform/ArgsUniform.cs +++ b/ArgsUniform/ArgsUniform.cs @@ -203,6 +203,7 @@ namespace ArgsUniform { if (uniformProperty.PropertyType == typeof(int?)) return AssignOptionalInt(result, uniformProperty, value); if (uniformProperty.PropertyType.IsEnum) return AssignEnum(result, uniformProperty, value); + if (uniformProperty.PropertyType == typeof(bool)) return AssignBool(result, uniformProperty, value); throw new NotSupportedException(); } @@ -230,6 +231,15 @@ namespace ArgsUniform return false; } + private static bool AssignBool(T result, PropertyInfo uniformProperty, object value) + { + if (value != null) + { + uniformProperty.SetValue(result, true); + } + return true; + } + private string? GetFromArgs(string key) { var argKey = $"--{key}=";