8000 try to fix pygbag failing when --help passed by wade-cheng · Pull Request #205 · pygame-web/pygbag · GitHub
[go: up one dir, main page]

Skip to content

try to fix pygbag failing when --help passed #205

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wade-cheng
Copy link

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.

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.

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

Successfully merging this pull request may close these issues.

1 participant
0