The "Synopsis" section of the help string.
(component, actions_grouped_by_kind, spec, metadata,
trace=None)
| 116 | |
| 117 | |
| 118 | def _SynopsisSection(component, actions_grouped_by_kind, spec, metadata, |
| 119 | trace=None) -> tuple[str, str]: |
| 120 | """The "Synopsis" section of the help string.""" |
| 121 | current_command = _GetCurrentCommand(trace=trace, include_separators=True) |
| 122 | |
| 123 | possible_actions = _GetPossibleActions(actions_grouped_by_kind) |
| 124 | |
| 125 | continuations = [] |
| 126 | if possible_actions: |
| 127 | continuations.append(_GetPossibleActionsString(possible_actions)) |
| 128 | if callable(component): |
| 129 | callable_continuation = _GetArgsAndFlagsString(spec, metadata) |
| 130 | if callable_continuation: |
| 131 | continuations.append(callable_continuation) |
| 132 | elif trace: |
| 133 | # This continuation might be blank if no args are needed. |
| 134 | # In this case, show a separator. |
| 135 | continuations.append(trace.separator) |
| 136 | continuation = ' | '.join(continuations) |
| 137 | |
| 138 | text = f'{current_command} {continuation}' |
| 139 | return ('SYNOPSIS', text) |
| 140 | |
| 141 | |
| 142 | def _DescriptionSection(component, info) -> tuple[str, str] | None: |
no test coverage detected