Skip to content

Conversation

wade-cheng
Copy link

@wade-cheng wade-cheng commented Apr 23, 2025

pygbag errors with codes 89 and 83 when called with just --help.

$ pygbag --help
89: Error, Last argument must be a valid app top level directory, or the main.py python script
83: Error, no main.py .../--help/main.py found in folder
89: missing requirement(s)

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 --help to 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 calls main_run. This means if we create our parser in main_run, we will fail even if we just run pygbag --help. Thus, I created a get_parser function that can be called with get_parser(None, None, None, None) in set_args when --help is 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.

@pmp-p
Copy link
Member

pmp-p commented Jul 26, 2025

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.

@pmp-p pmp-p added usage enhancement New feature or request labels Jul 26, 2025
@wade-cheng
Copy link
Author

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.)

@pmp-p
Copy link
Member

pmp-p commented Aug 17, 2025

what if --help without script sent usage , and add '--help <folder/main.py>' to usage ?
and yeah check that it work with all exotic OS entrypoints ( ie mac/win )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants