Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] Consider adding an event that allow us intercept events #9538

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

Closed
marcospassos opened this issue Nov 19, 2013 · 6 comments
Closed

Comments

@marcospassos
Copy link

When we were discussing about how introduce console events, I talked about the possibility of intercepting all events in order to include a new parameter. Now, using the console.command is possible to add such parameter but we can't retrieve its value.

I think it can be achieved introducing a pre and post bound event, where in the first we have the opportunity to append a new option and in the second retrieve its value and perform some action.

Seems like other users have the same use case and for now the only workaround is very ugly and not recommended.

@matthiasnoback
Copy link

The article mentioned was written be me - indeed it was not very straigh-forward to add an option to the application's input definition and get it parsed correctly at all times. The thing is: the input object which can be retrieved from a console event using getInput() is actually useless. It has not been bound to either input definition so you have to do it yourself.

I think it would be great to have a way to hook into the process of creating the application's input definition (maybe using something like "console application extensions"). And/or to make the console.command event more useful by pre-binding the input object. This may require some rework, since now the binding happens inside the command's run()metthod, which is after the event is dispatched.

@TomasVotruba
Copy link
Contributor

@marcospassos Is this issue still relevant? How do you approach it now?

@wouterj
Copy link
Member

wouterj commented Nov 22, 2015

This is now possible in 2.8/3.0, as #15938 is merged. See the test included in that PR on how to achieve this.

@TomasVotruba
Copy link
Contributor

Great! This issue can be closed then, right?

@marcospassos
Copy link
Author

Yes, @TomasVotruba. Thanks!

@TomasVotruba
Copy link
Contributor

@marcospassos Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants