MCPcopy
hub / github.com/google/python-fire / _NameSection

Function _NameSection

fire/helptext.py:97–115  ·  view source on GitHub ↗

The "Name" section of the help string.

(component, info, trace=None, verbose=False)

Source from the content-addressed store, hash-verified

95
96
97def _NameSection(component, info, trace=None, verbose=False) -> tuple[str, str]:
98 """The "Name" section of the help string."""
99
100 # Only include separators in the name in verbose mode.
101 current_command = _GetCurrentCommand(trace, include_separators=verbose)
102 summary = _GetSummary(info)
103
104 # If the docstring is one of the messy builtin docstrings, show custom one.
105 if custom_descriptions.NeedsCustomDescription(component):
106 available_space = LINE_LENGTH - SECTION_INDENTATION - len(current_command +
107 ' - ')
108 summary = custom_descriptions.GetSummary(component, available_space,
109 LINE_LENGTH)
110
111 if summary:
112 text = f'{current_command} - {summary}'
113 else:
114 text = current_command
115 return ('NAME', text)
116
117
118def _SynopsisSection(component, actions_grouped_by_kind, spec, metadata,

Callers 1

HelpTextFunction · 0.85

Calls 2

_GetCurrentCommandFunction · 0.85
_GetSummaryFunction · 0.85

Tested by

no test coverage detected