nest-commander icon indicating copy to clipboard operation
nest-commander copied to clipboard

How to Access showHelpAfterError/showSuggestionAfterError/Other Options

Open ProfessorManhattan opened this issue 2 years ago • 6 comments

Is there an existing issue that is already proposing this?

  • [X] I have searched the existing issues

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

ProfessorManhattan avatar Nov 02 '21 10:11 ProfessorManhattan

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?

jmcdo29 avatar Nov 02 '21 15:11 jmcdo29

ping @ProfessorManhattan :eyes:

micalevisk avatar Aug 07 '22 22:08 micalevisk

ping @ProfessorManhattan :eyes:

You rang?

ProfessorManhattan avatar Aug 07 '22 23:08 ProfessorManhattan

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

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

it's fine to me

micalevisk avatar Aug 07 '22 23:08 micalevisk

: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.

ProfessorManhattan avatar Aug 07 '22 23:08 ProfessorManhattan

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

jmcdo29 avatar Aug 08 '22 14:08 jmcdo29