jmcdo29 / nest-commander

A module for using NestJS to build up CLI applications
https://nest-commander.jaymcdoniel.dev/
MIT License
427 stars 53 forks source link

How to Access showHelpAfterError/showSuggestionAfterError/Other Options #123

Open ProfessorManhattan opened 2 years ago

ProfessorManhattan commented 2 years ago

Is there an existing issue that is already proposing this?

Is your feature request related to a problem? Please describe it

Hey, how can I access other options that are not available as decorators. On https://www.npmjs.com/package/commander there are a lot of features that are not detailed in the nestjs-commander documentation. In particular, how can I access showHelpAfterError() and showSuggestionAfterError()?

Describe the solution you'd like

More docs or expose the regular commander.js methods somehow.

Teachability, documentation, adoption, migration strategy

N/a

What is the motivation / use case for changing the behavior?

N/A

jmcdo29 commented 2 years ago

This is something I need to add support for I believe. I'm thinking they'll be options as a part of the @Command() decorator, something like

@Command({ name: 'foo', options: { showSuggestionAfterError: boolean | string, showHelpAfterError: boolean | string })

So that the setup can just call the method or pass the message directly. I don't see a reason to get DI involved here, right?

micalevisk commented 2 years ago

ping @ProfessorManhattan :eyes:

ProfessorManhattan commented 2 years ago

ping @ProfessorManhattan :eyes:

You rang?

micalevisk commented 2 years ago

:smile: do you agree with that interface to solve this issue?

@Command({
    name: 'foo',
    options: {
        showSuggestionAfterError: true,
        showHelpAfterError: '',
    }
})

it's fine to me

ProfessorManhattan commented 2 years ago

:smile: do you agree with that interface to solve this issue?

@Command({
  name: 'foo',
  options: {
      showSuggestionAfterError: true,
      showHelpAfterError: '',
  }
})

it's fine to me

Yeah, it's been awhile but that would be good. I remember wanting to be able to access the native commander library object as well.

jmcdo29 commented 2 years ago

You can access the command instance in v3.0.0 with this.command after extending the CommandRunner