Skip to content
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

Support command examples #20

Closed
akuntsch opened this issue Oct 18, 2024 · 1 comment · Fixed by #34
Closed

Support command examples #20

akuntsch opened this issue Oct 18, 2024 · 1 comment · Fixed by #34
Labels
core ⚙ Relates to the @stricli/core package

Comments

@akuntsch
Copy link

akuntsch commented Oct 18, 2024

Is your feature request related to a problem? Please describe.
The problem of not being able to provide full command examples with descriptions.

Describe the solution you'd like
Support command examples with descriptions and show them in the auto-generated help text.

I'm thinking of something like this:

buildCommand({
  ...
  docs: {
    examples: [
      { command: 'mycommand --flag1 value1 ....', description: 'Does this and that' },
      ...
    ],
    ...
  },
  ...
});

Might also use an array of arrays like some other frameworks do, but I personally prefer explicit properties.

The generated help text should then have an EXAMPLES section where the examples are shown.

Describe alternatives you've considered
I tried using customUsage but there's not really a way to get the desired result with that.

Additional context
This feature is supported by many other cli frameworks and can be pretty useful imo.

@molisani molisani added the core ⚙ Relates to the @stricli/core package label Oct 20, 2024
@molisani
Copy link
Member

molisani commented Nov 2, 2024

This is a good idea, but I wonder if there would be some way to enhance the usage section to have documented use cases. I think having USAGE and EXAMPLES is a bit too repetitive and the existing USAGE section could use some more customizability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core ⚙ Relates to the @stricli/core package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants