DjangoHelpFormatter
Customized formatter so that command-specific arguments appear in the --help output before arguments common to all commands.
Attributes
| Attribute | Type | Description |
|---|---|---|
| show_last | set = {"--version", "--verbosity", "--traceback", "--settings", "--pythonpath", "--no-color", "--force-color", "--skip-checks"} | A set of command-line option strings that are prioritized to appear at the end of the help output to ensure command-specific arguments are displayed first. |
Methods
add_usage()
@classmethod
def add_usage(
usage: string,
actions: list,
*args: any,
**kwargs: any
)
Adds the usage section to the help message, ensuring that the displayed arguments follow the custom reordering logic.
Parameters
| Name | Type | Description |
|---|---|---|
| usage | string | The usage string or template to be formatted. |
| actions | list | The list of argparse actions to include in the usage synopsis. |
| *args | any | Positional arguments passed to the parent HelpFormatter.add_usage method. |
| **kwargs | any | Keyword arguments passed to the parent HelpFormatter.add_usage method. |
add_arguments()
@classmethod
def add_arguments(
actions: list
)
Adds the arguments section to the help output using a reordered list of actions to prioritize command-specific flags.
Parameters
| Name | Type | Description |
|---|---|---|
| actions | list | The list of argparse actions to be formatted into the arguments section of the help text. |