예제 #1
0
        private static IBlock BuildOptionInfo(Option option)
        {
            Section result = new Section(
                new Header(option.Documentation?.Title ?? option.GetMainRepresentation()));
            ISpanBuilder content = new SpanBuilder();

            foreach (string representation in option.Representations)
            {
                using (content.StartStrongContext())
                {
                    string optionInput = representation.Length > 2
                        ? $"--{representation}"
                        : $"-{representation}";

                    content.Link(optionInput, ActionBuilder.InputAddUri(optionInput));
                }

                content.WriteLine();
            }

            result = result.AddChild(new Paragraph(content.Span));

            if (!string.IsNullOrEmpty(option.Documentation?.Description))
            {
                result = result.AddChild(new Paragraph(option.Documentation.Description));
            }

            if (option.Parameters.Count > 0)
            {
                result = result.AddChild(BuildParametersSection(option));
            }

            return(result);
        }