예제 #1
0
파일: Arguments.cs 프로젝트: CptWesley/Clap
        private static string GetArgumentName(PropertyInfo property)
        {
            ArgumentNameAttribute attribute = property.GetCustomAttribute <ArgumentNameAttribute>();

            if (IsArrayLike(property))
            {
                Type type = GetArrayLikeElementType(property);

                return($"{GetArgumentName(type, attribute, "1")} {GetArgumentName(type, attribute, "2")} ...");
            }

            return(GetArgumentName(property.PropertyType, attribute, string.Empty));
        }
예제 #2
0
파일: Arguments.cs 프로젝트: CptWesley/Clap
        private static string GetArgumentName(Type type, ArgumentNameAttribute attribute, string suffix)
        {
            if (type == typeof(bool))
            {
                return(string.Empty);
            }

            if (type.IsEnum)
            {
                return(string.Join("|", Enum.GetNames(type)));
            }

            if (attribute != null)
            {
                return($"<{attribute.Name}{suffix}>");
            }

            return($"<{type.Name}{suffix}>");
        }