-
Notifications
You must be signed in to change notification settings - Fork 3
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
Allow parsing of multiple args for a command #102
Comments
Do I understand this correctly: You want to add a menu entry. When this entry is called like
It should call the action body with the two parameters
Is that right? I think the only generic approach to this would be to add something like a regex, that parses the argument and fills in the varargs of the action body. This could probably be done in the library itself. But why not just parse the regex in the action body directly? You have full control then. That is to say, I would probably do it like this:
|
You understand it right. :) In addition I would even like to call Yeah, it works your way, but it is not that convinient. Maybe think about adding a argument parsing similar to PowerArgs. Let me know your decision. EDIT: I know this has no high priority. In addition I think it is not that trivial, since it would involve reflection stuff. Maybe using PowerArgs in combination is the right way... I don't want to invent the wheel again, you don't want the dependency to PowerArgs, I guess... |
I did not know about PowerArgs, it looks like a nice library. Thanks for showing! I see some synergy in adding it here. However, it is also a significant change and dependency that I need to examine in detail. Currently I sadly lack the time, so I want to postpone this for now. Sorry! For your use case, I'm not sure if it is possible, but what comes to mind is deriving from What sadly does not work at the moment is using the predefined Add-style methods like However, I'll add a factory method in the next patch. Then your own class gets constructed when you call |
It's in the master branch. I'll push it to Nuget later, too. |
Allow stuff like
menu.Add("greet", (x,y) => Greet(x,y), "Greets a name a number of times.");
Would be great to have multiple parsed arguments instead of a single string.
The text was updated successfully, but these errors were encountered: