Exemple #1
0
        private ICommandResult List(CommandContext context)
        {
            List result = new List();

            foreach (Query command in setting.Configuration.Runtime.Commands.OrderBy(c => c.Key))
            {
                string commandName = command.GetMainRepresentation();

                result = result.AddItem(new ListItem(
                                            new Span(
                                                new Strong(
                                                    new Model.Text.Link(commandName, ActionBuilder.CommandRunUri($"help info {commandName}"))),
                                                new PlainText(": "),
                                                new Italic(command.Documentation.Description))));
            }

            return(new ModeledResult(result));
        }
Exemple #2
0
        private static IBlock BuildQueryInfo(Query query, string input, bool listChildren)
        {
            input += " " + query.GetMainRepresentation();
            input  = input.Trim();

            Section result = new Section(
                new Header(query.Documentation?.Title ?? query.GetMainRepresentation()),
                new Paragraph(
                    new Model.Text.Link(input, ActionBuilder.CommandRunUri($"help info {input}"))));

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

            if (!listChildren)
            {
                return(result);
            }

            if (query.Queries.Count > 0)
            {
                result = result.AddChild(BuildQueriesSection(query, input));
            }

            if (query.Options.Count > 0)
            {
                result = result.AddChild(BuildOptionsSection(query));
            }

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

            return(result);
        }