try to fix pygbag failing when --help passed#205
Conversation
|
when no param is given, i had the silly idea to make a Textual interface to pick folder and select a file as main.py ( even if it is not named main.py), also check what modules to package with the game and a generic options editor which could build upon the pygbag.ini when i give up on the idea merging will be obvious, thanks for the effort and the patience. |
|
quite embarrasingly, I forgot to check the issue tracker, where #96 mentions this. (also, I feel the need to state again that this is a really conceptual pr and very well could be bugged and breaks everything haha. Though, I was fairly sure that if bugged, it becomes sound after a little bugfixing.) |
|
what if --help without script sent usage , and add '--help <folder/main.py>' to usage ? |
pygbag errors with codes 89 and 83 when called with just
--help.This may be confusing. Command line programs usually do not fail when called with just
--help, even if they usually require other arguments on standard runs. To get--helpto work with pygbag, one must use it alongside a valid argument, which the user may not know how to choose without the help text. Catch-22!I did some digging, and pygbag first processes args with
set_args, failing if the app folder or other metadata could not be found. Then, it callsmain_run. This means if we create our parser inmain_run, we will fail even if we just runpygbag --help. Thus, I created aget_parserfunction that can be called withget_parser(None, None, None, None)inset_argswhen--helpis in the command line arguments, to parse it to print out help data and then exit.This might work, but might not. I didn't figure out how to run pygbag locally, so the coding was done a bit blind.