Skip to content

Consider an alternative that doesn't have HelpBuilder.Default as a nested class #1931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #1891
jonsequitur opened this issue Nov 2, 2022 · 0 comments
Open
Tracked by #1891

Comments

@jonsequitur
Copy link
Contributor

jonsequitur commented Nov 2, 2022

        // Nested classes are prohibited if (handwaving) more than 30 people in the world will ever need to use them. (Or a few very niche situations that don't apply here).
        // Probably wants to be something like "HelpDefaults" as a top level type.
        public static class Default
        {
            // All of these feel like properties.
            public static HelpSectionDelegate AdditionalArgumentsSection();
            public static HelpSectionDelegate CommandArgumentsSection();
            public static HelpSectionDelegate CommandUsageSection();
            public static HelpSectionDelegate OptionsSection();
            public static HelpSectionDelegate SubcommandsSection();
            public static HelpSectionDelegate SynopsisSection();
 
            // I don't understand what these mean in the context of HelpDefaults.  Like, the first one feels like it's just `argument.GetDefaultValue()?.ToString()`.
            // If it's not, it needs a better name.
            public static string GetArgumentDefaultValue(Argument argument);
            public static string GetArgumentDescription(Argument argument);
            public static string GetArgumentUsageLabel(Argument argument);
            public static string GetIdentifierSymbolDescription(IdentifierSymbol symbol);
            public static string GetIdentifierSymbolUsageLabel(IdentifierSymbol symbol, HelpContext context);
 
            // GetDefaultLayout, maybe?
            public static IEnumerable<HelpSectionDelegate> GetLayout();
        }
    }
 
    // To instance methods.
    public static class HelpBuilderExtensions 
    {
        public static void CustomizeSymbol(this HelpBuilder builder, Symbol symbol, string firstColumnText = null, string secondColumnText = null, string defaultValue = null);
        public static void Write(this HelpBuilder helpBuilder, Command command, TextWriter writer);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant