citymania-org / grf-py

A Python framework for making NewGRFs for OpenTTD
GNU General Public License v2.0
14 stars 3 forks source link

Allow argparse to be used in the generate.py #37

Closed Brickblock1 closed 1 month ago

Brickblock1 commented 1 month ago

Currently a project using grf-py can't use argparse on it's own without getting errors due to grf-py not recognising the options. this pr solves that byusing parse_known_args instead of parse_args which would throw an error

ldpl commented 1 month ago

What's the usecase of this would be? I can understand adding more ways to integrate with grf-py argparser like existing commands argument to grf.main. But parse_known_args will only allow making bad cli imo.

Brickblock1 commented 1 month ago

I decided to do it like this just to get it working but there may be better ways of doing this

ldpl commented 1 month ago

yeah, but what exactly are you trying to get working? like, what arguments do you want to add?

Brickblock1 commented 1 month ago

Take a look at robs trains but I just wanted to pass -c to copy the generated file to the newgrf folder

ldpl commented 1 month ago

But that -c option only makes sense for build and watch commands. So, even though I'm not against adding custom build options this is not the way to do it.