| 179 | doc.write('*None*\n') |
| 180 | |
| 181 | def doc_option(self, arg_name, help_command, **kwargs): |
| 182 | doc = help_command.doc |
| 183 | argument = help_command.arg_table[arg_name] |
| 184 | if argument.required or getattr( |
| 185 | argument, '_DOCUMENT_AS_REQUIRED', False |
| 186 | ): |
| 187 | required_field = ' [required]' |
| 188 | else: |
| 189 | required_field = '' |
| 190 | |
| 191 | if argument.group_name in self._arg_groups: |
| 192 | if argument.group_name in self._documented_arg_groups: |
| 193 | # This arg is already documented so we can move on. |
| 194 | return |
| 195 | name = ' | '.join( |
| 196 | [ |
| 197 | f'``{a.cli_name}``' |
| 198 | for a in self._arg_groups[argument.group_name] |
| 199 | ] |
| 200 | ) |
| 201 | self._documented_arg_groups.append(argument.group_name) |
| 202 | else: |
| 203 | name = f'``{argument.cli_name}``' |
| 204 | doc.write( |
| 205 | f'{name} ' |
| 206 | f'({self._get_argument_type_name(argument.argument_model, argument.cli_type_name)})' |
| 207 | f'{required_field}\n' |
| 208 | ) |
| 209 | |
| 210 | doc.style.indent() |
| 211 | doc.include_doc_string(argument.documentation) |
| 212 | if is_streaming_blob_type(argument.argument_model): |
| 213 | self._add_streaming_blob_note(doc) |
| 214 | if is_tagged_union_type(argument.argument_model): |
| 215 | self._add_tagged_union_note(argument.argument_model, doc) |
| 216 | if hasattr(argument, 'argument_model'): |
| 217 | self._document_enums(argument.argument_model, doc) |
| 218 | self._document_constraints(argument.argument_model, doc) |
| 219 | self._document_nested_structure(argument.argument_model, doc) |
| 220 | doc.style.dedent() |
| 221 | doc.style.new_paragraph() |
| 222 | |
| 223 | def doc_global_option(self, help_command, **kwargs): |
| 224 | doc = help_command.doc |