예제 #1
0
        private void MapParameter <T>(
            T result,
            string key,
            ParsedArgument <string[]> arg
            ) where T : ParsedArguments
        {
            if (!PropertiesOf(typeof(T))
                .TryGetValue(key, out var propInfo))
            {
                return;
            }

            var wasMapped = Mappers.Aggregate(
                false,
                (acc, cur) => acc || cur(propInfo, arg, result)
                );

            if (wasMapped)
            {
                return;
            }

            if (arg.IsRequired)
            {
                throw new ArgumentException(
                          $"Argument: {key} is required"
                          );
            }
        }