-
Notifications
You must be signed in to change notification settings - Fork 33
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
T4 generated strongly typed docopt return object #2
Comments
Sounds interesting, looking forward to see how it works out! You might be the first one to implement code generation for docopt. I don't know this T4 stuff :-), but I would guess that usually you need a single |
T4 is a design time code generator integrated in Visual Studio. It's a little bit ugly but it's really powerful. You're right: in 90% of the use cases there will be a single usage.txt. However looking at the git example, it sounds like there could be multiple usage.txt if the implementor chooses to group all the command line parsing in one project. |
So I managed to put together a working version of the code generator. It was much easier than I expected. Sample generated code here. DesignI have introduced a The original arguments dictionary is still available through an In a second iteration, I will move the code generation code out of the core docopt implementation as I don't feel it really belong there. It should be in the T4 module. Worked exampleMain.usage.txtTest. Usage: prog command ARG FILES... [-o --switch --long=ARG] Generated code: T4DocoptNet.cs
Using the generated code
Planned improvements
|
👍 |
As an alternative to the return dictionary we should use a T4 template to generate a strongly typed return object for each usage text defined in the project.
The text was updated successfully, but these errors were encountered: