private string GetShortName() { string attributeShortName = AttributeProvider.GetCustomAttribute <OptionAttribute>()?.ShortName; if (!string.IsNullOrEmpty(attributeShortName)) //provided by user { return(attributeShortName); } //use parameter name as short name return(PropertyOrArgumentName.Length == 1 ? PropertyOrArgumentName.ChangeCase(Settings.Case) : null); }
private BooleanMode GetBooleanMode() { OptionAttribute attribute = AttributeProvider.GetCustomAttribute <OptionAttribute>(); if (attribute == null || attribute.BooleanMode == BooleanMode.Unknown) { return(Settings.BooleanMode); } return(UnderlyingType == typeof(bool) ? attribute.BooleanMode : throw new AppRunnerException( $"BooleanMode property is set to `{attribute.BooleanMode}` for a non boolean parameter type. " + $"Property name: {PropertyOrArgumentName} " + $"Type : {Type.Name}")); }
private string GetLongName() { string attributeLongName = AttributeProvider.GetCustomAttribute <OptionAttribute>()?.LongName; if (!string.IsNullOrEmpty(attributeLongName)) //long name attribute provided by user { return(attributeLongName); } //short name is not present, if (string.IsNullOrEmpty(ShortName) && PropertyOrArgumentName.Length > 1) { return(PropertyOrArgumentName.ChangeCase(Settings.Case)); //return parameter name as long name } //there is no long name return(null); }
private string GetAnnotatedDescription() { return(AttributeProvider.GetCustomAttribute <ArgumentAttribute>()?.Description); }
protected override string GetAnnotatedDescription() { ArgumentAttribute descriptionAttribute = AttributeProvider.GetCustomAttribute <ArgumentAttribute>(); return(descriptionAttribute?.Description); }