예제 #1
0
        private void ShowAllHelp(IndentingTextWriter writer, int?columns = null)
        {
            string sig = _kind?.ToLowerInvariant();

            var infos = ComponentCatalog.GetAllClasses()
                        .OrderBy(info => info.LoadNames[0].ToLowerInvariant())
                        .ThenBy(info => ComponentCatalog.SignatureToString(info.SignatureTypes[0]).ToLowerInvariant());
            var components = new List <Component>();

            foreach (var info in infos)
            {
                // REVIEW: We should only be printing the usage once, not for every signature.
                _env.AssertValue(info.SignatureTypes);
                foreach (var signature in info.SignatureTypes)
                {
                    _env.Assert(signature.BaseType == typeof(MulticastDelegate));

                    string kind = ComponentCatalog.SignatureToString(signature);
                    if (sig != null && !kind.StartsWithInvariantCultureIgnoreCase(sig))
                    {
                        continue;
                    }

                    // Don't show classes that have no arguments.
                    var args = info.CreateArguments();
                    if (args == null)
                    {
                        continue;
                    }

                    ShowUsage(writer, kind, info.Summary, info.LoadNames[0], info.LoadNames, args, columns);
                    components.Add(new Component(kind, info, args));
                }
            }

            if (components.Count > 0)
            {
                Serialize(components);
            }
        }