Need a way to inject current command (instead of root command)
See original GitHub issueIs 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
I noticed that there is a decorator at present named InjectCommander
, it can inject the root command object.
But sometimes, some functions requires to get the current command object, command.help()
eg. different commands print different content.
Describe the solution you’d like
@InjectCurrentCommander()
or@InjectCommander({ current: true })
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
Get current command / sub-command object.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
What is OS command injection, and how to prevent it?
In this section, we'll explain what OS command injection is, describe how vulnerabilities can be detected and exploited, spell out some useful commands...
Read more >What Is Command Injection? | Examples, Methods & Prevention
Command injection is a cyber attack that involves executing arbitrary commands on a host operating system (OS). Learn more.
Read more >A Pentester's Guide to Command Injection - Cobalt.io
Command injection is an attack in which the goal is to execute arbitrary commands on the host operating system via a vulnerable application....
Read more >Run same command again but as root - sudo - Ask Ubuntu
The simplest way is to run: sudo !! This will run the last command but as super user.
Read more >Command Injection
They have the same property that the query statement is not generated from user input and parameters are clearly identified. While SQL injection...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think what I’m going to end up doing is adding a
commandInstance
property and makingCommandRunner
anabstract
class (breaking change) instead of anintrerface
then setting that value from theCommandRunnerService
class when creating the command. That way,this.commandInstance
now points to the current command. As the commands aren’t registered in the DI tree, it won’t be possible to do@InjectCommand()
or anything like that, but this should be a decent solution insteadI’ll see if I can figure out some sort of way to implement this soon. Thanks for the suggestion