public CommandSectionTag(string applicationName, CommandReport report)
            : base("section")
        {
            AddClass("command-section");
            var h4 = Add("h4");

            h4.Add("span")
                .Text(applicationName + " " + report.Name)
                .AddClass("section-header")
                .Id(report.Name);

            h4.Add("i").AddClass("command-description").Text(report.Description);
        }
Beispiel #2
0
        public FlagsTag(CommandReport report)
        {
            AddClass("table");
            AddHeaderRow(tr => tr.Header("Flags").Attr("colspan", 2));

            report.Flags.Each(x =>
            {
                AddBodyRow(tr =>
                {
                    tr.Cell(x.UsageDescription).AddClass("command-flag-usage");
                    tr.Cell(x.Description).AddClass("command-flag-description");
                });
            });
        }
        public ArgumentsTag(CommandReport report)
        {
            AddClass("table");
            AddHeaderRow(tr => tr.Header("Arguments").Attr("colspan", 2));

            report.Arguments.Each(x =>
            {
                AddBodyRow(tr =>
                {
                    tr.Cell(x.Name).AddClass("command-arg-name");
                    tr.Cell(x.Description).AddClass("command-arg-description");
                });
            });
        }
        public UsageTableTag(CommandReport report)
        {
            AddClass("table");
            AddClass("usages-table");
            AddHeaderRow(tr => tr.Header("Usages").Attr("colspan", 2));

            report.Usages.Each(x =>
            {
                AddBodyRow(tr =>
                {
                    tr.Cell(x.Description);
                    tr.Cell(x.Usage).AddClass("command-usage");
                });
            });
        }
        public static IEnumerable<HtmlTag> CommandBodyTags(string applicationName, CommandReport report)
        {
            if (report.Usages.Count() == 1)
            {
                yield return new SingleUsageTag(report.Usages.Single());
            }
            else
            {
                yield return new UsageTableTag(report);
            }

            if (report.Arguments.Any())
            {
                yield return new ArgumentsTag(report);
            }

            if (report.Flags.Any())
            {
                yield return new FlagsTag(report);
            }
        }