Skip to content
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

Generate header file #39

Open
kroq-gar78 opened this issue May 29, 2017 · 2 comments
Open

Generate header file #39

kroq-gar78 opened this issue May 29, 2017 · 2 comments

Comments

@kroq-gar78
Copy link

kroq-gar78 commented May 29, 2017

I think this would be a little more convenient to use if it generated a header file with just DocoptArgs and docopt(). The use case for this would be a program that deals with parsed arguments in many places.

If the parsed arguments (DocoptArgs) are needed in different files that are eventually linked together, we can't just do #include "docopt.c" like in the main file, since we would be redefining various variables and functions. We would instead have to redefine just the struct in each file that the parsed arguments are needed.

@kroq-gar78
Copy link
Author

I wouldn't mind taking this on myself, if I knew what CLI options I should add.

I was thinking of -H <path> and --output-header <path> that would set the destination for the header. The question then would be the path that .c file uses to include the header (should it be relative? assume it's in the same directory?).

Another option would be that if -o (or --output-name) is used, then we swap the extension with .h for the header and let the .c file assume it's in the same directory.

This is more of a brainstorm, but any thoughts are appreciated.

@kroq-gar78
Copy link
Author

kroq-gar78 commented May 30, 2017

I decided to take the second option and put it in my fork. I'm not going to submit a PR because I think I didn't really follow the exiting code style.

See master...kroq-gar78:master for my changes

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

No branches or pull requests

1 participant