Build completion hint for a given argument.
(parser: Cmd2ArgumentParser, arg_action: argparse.Action)
| 50 | |
| 51 | |
| 52 | def _build_hint(parser: Cmd2ArgumentParser, arg_action: argparse.Action) -> str: |
| 53 | """Build completion hint for a given argument.""" |
| 54 | # Check if hinting is disabled for this argument |
| 55 | suppress_hint = arg_action.get_suppress_tab_hint() # type: ignore[attr-defined] |
| 56 | if suppress_hint or arg_action.help == argparse.SUPPRESS: |
| 57 | return "" |
| 58 | |
| 59 | # Use the parser's help formatter to display just this action's help text |
| 60 | formatter = parser._get_formatter() |
| 61 | formatter.start_section("Hint") |
| 62 | formatter.add_argument(arg_action) |
| 63 | formatter.end_section() |
| 64 | return formatter.format_help() |
| 65 | |
| 66 | |
| 67 | def _single_prefix_char(token: str, parser: Cmd2ArgumentParser) -> bool: |
no test coverage detected
searching dependent graphs…