Tyrrrz/CliFx

Command examples

Open

#115 opened on Dec 5, 2021

View on GitHub
 (3 comments) (2 reactions) (0 assignees)C# (64 forks)github user discovery
enhancementgood first issue

Repository metrics

Stars
 (1,603 stars)
PR merge metrics
 (Avg merge 3d 1h) (1 merged PR in 30d)

Description

Discussed in https://github.com/Tyrrrz/CliFx/discussions/114

Originally posted by wayneyaoo December 4, 2021 Can we have concept of "Example" for each command that can be specified by the CLI author and a new section is rendered as "EXAMPLE".

I was imaging something like

[Command("verb")]
public class MyCommand : ICommand
{
    // options and parameters go here as property

    [Example]
    public (static) Example[] Examples = new [] 
        { new Example("verb --option value"), new Example("verb --anotherPositionalOption") };
}

and the examples could be rendered to another section like "EXAMPLE" when ./myapp verb -h is called.

I'm happy to contribute if this looks good. Or we can discuss.

Contributor guide