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

How to Access showHelpAfterError/showSuggestionAfterError/Other Options #123

Open
1 task done
ProfessorManhattan opened this issue Nov 2, 2021 · 6 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@ProfessorManhattan
Copy link

Is there an existing issue that is already proposing this?

  • 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 ProfessorManhattan added the enhancement New feature or request label Nov 2, 2021
@jmcdo29
Copy link
Owner

jmcdo29 commented Nov 2, 2021

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
Copy link
Contributor

ping @ProfessorManhattan 👀

@ProfessorManhattan
Copy link
Author

ping @ProfessorManhattan 👀

You rang?

@micalevisk
Copy link
Contributor

micalevisk commented Aug 7, 2022

😄 do you agree with that interface to solve this issue?

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

it's fine to me

@ProfessorManhattan
Copy link
Author

😄 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
Copy link
Owner

jmcdo29 commented Aug 8, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants