MCPcopy
hub / github.com/tanelpoder/0xtools / format_help

Method format_help

lib/0xtools/argparse.py:225–248  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

223 self.items = []
224
225 def format_help(self):
226 # format the indented section
227 if self.parent is not None:
228 self.formatter._indent()
229 join = self.formatter._join_parts
230 for func, args in self.items:
231 func(*args)
232 item_help = join([func(*args) for func, args in self.items])
233 if self.parent is not None:
234 self.formatter._dedent()
235
236 # return nothing if the section was empty
237 if not item_help:
238 return ''
239
240 # add the heading if the section was non-empty
241 if self.heading is not SUPPRESS and self.heading is not None:
242 current_indent = self.formatter._current_indent
243 heading = '%*s%s:\n' % (current_indent, '', self.heading)
244 else:
245 heading = ''
246
247 # join the section-initial newline, the heading and the help
248 return join(['\n', heading, item_help, '\n'])
249
250 def _add_item(self, func, args):
251 self._current_section.items.append((func, args))

Callers

nothing calls this directly

Calls 2

_indentMethod · 0.80
_dedentMethod · 0.80

Tested by

no test coverage detected