MCPcopy Index your code
hub / github.com/pyinvoke/invoke / print_task_help

Method print_task_help

invoke/program.py:774–805  ·  view source on GitHub ↗

Print help for a specific task, e.g. ``inv --help ``. .. versionadded:: 1.0

(self, name: str)

Source from the content-addressed store, hash-verified

772 debug("Resulting task contexts: {!r}".format(self.tasks))
773
774 def print_task_help(self, name: str) -> None:
775 """
776 Print help for a specific task, e.g. ``inv --help <taskname>``.
777
778 .. versionadded:: 1.0
779 """
780 # Setup
781 ctx = self.parser.contexts[name]
782 tuples = ctx.help_tuples()
783 docstring = inspect.getdoc(self.collection[name])
784 header = "Usage: {} [--core-opts] {} {}[other tasks here ...]"
785 opts = "[--options] " if tuples else ""
786 print(header.format(self.binary, name, opts))
787 print("")
788 print("Docstring:")
789 if docstring:
790 # Really wish textwrap worked better for this.
791 for line in docstring.splitlines():
792 if line.strip():
793 print(self.leading_indent + line)
794 else:
795 print("")
796 print("")
797 else:
798 print(self.leading_indent + "none")
799 print("")
800 print("Options:")
801 if tuples:
802 self.print_columns(tuples)
803 else:
804 print(self.leading_indent + "none")
805 print("")
806
807 def list_tasks(self) -> None:
808 # Short circuit if no tasks to show (Collection now implements bool)

Callers 1

parse_cleanupMethod · 0.95

Calls 2

print_columnsMethod · 0.95
help_tuplesMethod · 0.80

Tested by

no test coverage detected