-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
opts() does not display all options #1610
Comments
Adding a subcommand like this returns a new command, and the
There is not a single call to get all of the options with the global and local options combined. There is an open issue asking what people would like along these lines, which includes a fuller example: #1551 |
Right, i c, the current behavior is a bit confusing when it comes to that, I believe this make a lot of sense #1551 (comment) What is the best way to access this p.s I just approach it this way for now |
I am not sure what you are asking? There is example code in #1551 which writes out the program options and the subcommand options. Do you want access to the global options in your action handler without using a program variable? The action handler is also passed the subcommand and there is a |
Oh, right, I should of mentioned that initially,I wanted to access options out of the action handler. That is what I do now:
I hope it make sense for you now. |
Commander does not track which subcommand was called. A couple of ideas, but may not suit your use:
|
Yeah I c, your point, the second suggestion seems valid for my case, I will play around with that. Thanks for support! |
I have this code:
I am using typescript and calling the program through the npm start script:
"start": "node -r ts-node/register ./src/bin/ngvm.ts",
npm start -- pm -g
here is the
console.log(program)
:output
The text was updated successfully, but these errors were encountered: