MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / _build_hint

Function _build_hint

cmd2/argparse_completer.py:52–64  ·  view source on GitHub ↗

Build completion hint for a given argument.

(parser: Cmd2ArgumentParser, arg_action: argparse.Action)

Source from the content-addressed store, hash-verified

50
51
52def _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
67def _single_prefix_char(token: str, parser: Cmd2ArgumentParser) -> bool:

Callers 1

__init__Method · 0.85

Calls 2

_get_formatterMethod · 0.80
format_helpMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…