コード例 #1
0
        private StringBuilder AppendAliases(StringBuilder stringBuilder, IReadOnlyCollection <string> aliases)
        {
            if (aliases.Count == 0)
            {
                return(stringBuilder);
            }

            stringBuilder.AppendLine(Format.Bold("Aliases:"));

            foreach (var alias in FormatUtilities.CollapsePlurals(aliases))
            {
                stringBuilder.AppendLine($"• {alias}");
            }

            return(stringBuilder);
        }
コード例 #2
0
        public IActionResult Commands()
        {
            var modules = _commandHelpService.GetModuleHelpData();

            var mapped = modules.Select(m => new
            {
                Name     = m.Name,
                Summary  = m.Summary,
                Commands = m.Commands.Select(c => new
                {
                    Name       = c.Name,
                    Summary    = c.Summary,
                    Aliases    = FormatUtilities.CollapsePlurals(c.Aliases),
                    Parameters = c.Parameters,
                }),
            });

            return(Ok(mapped));
        }