<commit_before>using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace PowerCommandParser
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
    public class DescriptionAttribute : Attribute
    {
        public string Text { get; set; }
        public string Summary { get; set; }
		public DescriptionAttribute(){}
		public DescriptionAttribute(string summary)
		{
			Summary = summary;
		}
        public DescriptionAttribute(string summary, string text)
        {
			Summary = summary;
            Text = text;
        }
    }
	public class HelpText<T>
	{
		public string Name { get; set; }
		private DescriptionAttribute Description => typeof(T).GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
		public string Synopsis => Description.Summary;
		public string LongDescription => Description.Text; 
		private IEnumerable<PropertyInfo> OrderedProperties => typeof(T).GetProperties().OrderBy(p=>p.GetCustomAttributes().Min(a=>(a as PositionAttribute)?.Position) ?? int.MaxValue); 
		public string GetSyntax()
		{
			var result = Name;
			foreach (var parameter in OrderedProperties)
			{
				var positioned = parameter.GetCustomAttribute(typeof(PositionAttribute)) != null;
				var required = parameter.GetCustomAttribute(typeof(RequiredAttribute)) != null;
				var parameterType = parameter.PropertyType.ToString();
				var parameterText = parameter.Name;
				if (positioned)
					parameterText = $"[{parameterText}]";
					
				parameterText+=$" [{parameterType}]";
				if (!required)
					parameterText = $"[{parameterText}]";
					
				result += " " + parameterText;
			}
			
			return result;
		}
		
		public string GetParameterHelp()
		{
			return string.Join("\n\n", OrderedProperties
							.Select(p=>new {p,d = p.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute})<commit_msg>Provide defaults to help file when synoposis and description not provided<commit_after>using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace PowerCommandParser
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
    public class DescriptionAttribute : Attribute
    {
        public string Text { get; set; }
        public string Summary { get; set; }
		public DescriptionAttribute(){}
		public DescriptionAttribute(string summary)
		{
			Summary = summary;
		}
        public DescriptionAttribute(string summary, string text)
        {
			Summary = summary;
            Text = text;
        }
    }
	public class HelpText<T>
	{
		public string Name { get; set; }
		private DescriptionAttribute Description => typeof(T).GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
        public string ProgramName => typeof(T).Assembly.GetName().Name;
        public string Synopsis => Description?.Summary ?? ProgramName;
		public string LongDescription => Description?.Text; 
		private IEnumerable<PropertyInfo> OrderedProperties => typeof(T).GetProperties().OrderBy(p=>p.GetCustomAttributes().Min(a=>(a as PositionAttribute)?.Position) ?? int.MaxValue); 
		public string GetSyntax()
		{
			var result = Name;
			foreach (var parameter in OrderedProperties)
			{
				var positioned = parameter.GetCustomAttribute(typeof(PositionAttribute)) != null;
				var required = parameter.GetCustomAttribute(typeof(RequiredAttribute)) != null;
				var parameterType = parameter.PropertyType.ToString();
				var parameterText = parameter.Name;
				if (positioned)
					parameterText = $"[{parameterText}]";
					
				parameterText+=$" [{parameterType}]";
				if (!required)
					parameterText = $"[{parameterText}]";
					
				result += " " + parameterText;
			}
			
			return result;
		}
		
		public string GetParameterHelp()
		{
			return string.Join("\n\n", OrderedProperties
							.Select(p=>new {p,d = p.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute})
{'fraction_non_alphanumeric': 0.10660264105642257, 'fraction_numerical': 0.0, 'mean_word_length': 4.04969696969697, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4126409', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1072, 'n_words': 274}