private static IEnumerable<string> GetPrototypes(Option option) { var parameters = _descriptionParameterRegex.Matches(option.Description).Cast<Match>().Select(x => x.Captures[0].Value).ToList(); var prototypes = option.Prototype.TrimEnd('=').Split('|').Select(x => (x.Length == 1 ? $"-{x}" : $"--{x}")); if (parameters.Count > 0) prototypes = prototypes.Select(x => x + " " + StringUtils.Join(" ", parameters)); return prototypes; }
protected override void InsertItem(int index, Option item) { base.InsertItem (index, item); }
private static string GetOptionSyntax(Option option) { bool optional = option.Description.Contains("Optional"); return string.Format("{0}/{1}{2}{3}", (optional ? "[" : ""), option.Prototype, (option.Prototype.EndsWith(":") ? "value" : ""), (optional ? "]" : "")); }