Help Text Generation
params-proto automatically extracts and generates help text from your code documentation.
Overview
Help text is generated from multiple sources in a specific order:
- Inline comments - Quick parameter description
- Docstring Args section - Detailed parameter documentation
- Function docstring - Overall CLI description
- Auto-generated descriptions - If no documentation provided
Inline Comments
The simplest form of documentation:
Generated help:
Docstring Args Section
For more detailed documentation, use the Args section in your docstring:
Generated help combines both:
The inline comment appears first, then details from the docstring Args section.
Function Docstring
The function's main docstring becomes the CLI description:
Generated help:
All text before the first section header (Args:, Returns:, Raises:, etc.) appears in the help text. This allows multi-paragraph descriptions as long as they come before any structured documentation sections.
Auto-Generated Descriptions
If no documentation is provided, params-proto generates basic descriptions from parameter names:
Generated help:
The parameter name is converted from snake_case to a readable description.
Best Practices
1. Use Inline Comments for Quick Reference
2. Add Docstring for Details
3. Use Type Hints for Constraints
4. Document Class Attributes
5. Multi-Paragraph Descriptions
Everything before Args: appears in the help text.
Accessing Help Text
You can access the generated help text programmatically:
This is useful for:
- Testing help generation
- Documentation generation
- Logging and debugging
- Building documentation pages
Type Hints for Documentation
Use type hints to document valid values:
Related
- CLI Fundamentals - Core CLI features
- CLI Patterns - Advanced CLI patterns
- Naming Conventions - Name conversion rules
ANSI Formatting- Terminal colors and formatting- Configuration Patterns - Function and class documentation