sphinx-contrib / sphinx-contrib/autoprogram
Autoprogram with custom Formatter
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 48
- Forks
- 24
- Avg merge
- 2h 15m
- Merged PRs (30d)
- 1
Description
I'm using autoprogram to document a Python script that uses argparse with a custom Formatter class that inherits from argparse.ArgumentDefaultsHelpFormatter and argparse.RawDescriptionHelpFormatter.
The RST string returned by the render_rst() function defined in autoprogram.py is not aware of the formatter and therefore the default value (default = xxx) is not added to the help string.
I noticed that the parser instance inside the make_rst() method of the AutoprogramDirective class defined in autoprogram.py has a _get_formatter() method that returns the formatter and that the formatter object has a _format_action() method that correctly formats the action. I do not know if this can help in adding this feature to autoprogram.py but your opinion would be very appreciated.
Roberto
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in autoprogram.py by tracing render_rst() and AutoprogramDirective.make_rst(), then inspect how the parser's _get_formatter() and formatter's _format_action() are used. The work is done when RST generated for a parser using a custom formatter includes the action's default value in its help text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100