Skip to content

Make the help customiztaion "easier" #2669

Open

Description

@zgabi

The documentation (https://learn.microsoft.com/en-us/dotnet/standard/commandline/how-to-customize-help) shows that when the user wants to customize the help he needs to write a lot of unnecessary code. Create a class which in inherited from SynchronousCommandLineAction / AsynchronousCommandLineAction, find the HelpOption, etc...

I'd suggest you to simplify this.

For example:

  • the AnonymousSynchronousCommandLineAction / AnonymousAsynchronousCommandLineAction classes (which are used in the SetAction methods) could be public. So the user can write this:
                defaultHelpOption.Action = new AnonymousSynchronousCommandLineAction(parseResult =>
                {
                    Console.WriteLine("HEADER");
                    return oldAction.Invoke(parseResult);
                });

  • or replace the XXCommandLineAction classes with just simple delegates:
    public delegate int SynchronousCommandLineAction(ParseResult parseResult);
    public delegate Task<int> AsynchronousCommandLineAction(ParseResult parseResult, CancellationToken cancellationToken);

  • add helper methods to the root command which returns the Help and VersionOptions

Activity

  1. changed the title [-]Make the help customiztaion "easa.ier"[/-] [+]Make the help customiztaion "easier"[/+] on Aug 19, 2025
  2. modified the milestones: Triage, Backlog on Sep 16, 2025
  3. jonsequitur commented on Oct 9, 2025

    @jonsequitur
    Contributor

    Related: #2588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions