docopt / docopt.c

C-code generator for docopt language.
MIT License
318 stars 46 forks source link

C89; Python packaging; MSVC support; PEP8; `EXIT_SUCCESS`/`EXIT_FAILURE` #43

Closed SamuelMarks closed 3 years ago

SamuelMarks commented 4 years ago

Not sure if you want the argc type to be equal to the int main argc type, i.e., int.

keleshev commented 3 years ago

@SamuelMarks thanks for taking time to make this contribution. A lot of changes look good, but a lot of changes that I don't see the motivation for. Can you summarize your changes together with the motivation for them?

SamuelMarks commented 3 years ago

@keleshev Today for the first time in near-on a year I started contributing to this again (moved to my master branch also… as a merge didn't seem forthcoming).

To summarise the changes:

keleshev commented 3 years ago

What is the motivation to go from int to size_t and from typedef to struct?

Originally the Python script was designed such that you can put docopt.py and docopt_c.py in your project and just call python docopt_c.py. If you are not too much into Python you shouldn't need to worry about package managers and stuff. I would like to see this workflow remain. Otherwise, I'm positive about merging this.

SamuelMarks commented 3 years ago

I'm trying to recall why the size_t change (this was done April 2020).

I see the advantage of having a single .py file, but you also have the template files so maybe a Python package is a better idea?

https://github.com/offscale/libacquire#cli-interface

[…] use python -m pip install docopt-c then:

$ python -m docopt_c '.docopt' -o 'libacquire/acquire/cli'
keleshev commented 3 years ago

Yeah, a Python package is definitely a better idea for those that already use Python packages. I want this project to be friendly to C-only projects that don't want to have a package manager as a development depenency.

keleshev commented 3 years ago

If I'd do it now, I would embed the template into a Python docstring.

SamuelMarks commented 3 years ago

@keleshev Ok, you're the boss

Refactored to a single file. Even made it [continue to] work with setup.py so people can still pip install it

keleshev commented 3 years ago

@SamuelMarks thank you for your excellent effort.