sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
523 stars 75 forks source link

fix '--keep-going' sphinx argument error #134

Closed julian-poidevin closed 5 months ago

julian-poidevin commented 11 months ago

109 added --keep-going option but when used the getattr function call in cli.py was creating this error callback :

Traceback (most recent call last):
  File ".venv/bin/sphinx-autobuild", line 8, in <module>
    sys.exit(main())
  File "/workspaces/comboard-linux-image/docs/.venv/src/sphinx-autobuild/src/sphinx_autobuild/cli.py", line 176, in main
    build_args, pre_build_commands = _get_build_args(args)
  File "/workspaces/comboard-linux-image/docs/.venv/src/sphinx-autobuild/src/sphinx_autobuild/cli.py", line 21, in _get_build_args
    val = getattr(args, arg)
AttributeError: 'Namespace' object has no attribute '-keep-going'

This MR fixes that bug by converting the args namespace to a dictonnary and using arg_dict.get instead.

I'm not sure how clean is this solution since it's no longer using argparse getattr function. I'm not a full time Python dev so feel free to change the code.

For more context, here's my original issue comment post : https://github.com/executablebooks/sphinx-autobuild/pull/109#issuecomment-1643891064

welcome[bot] commented 11 months ago

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.
Welcome to the EBP community! :tada: