MCPcopy
hub / github.com/django/django / main_help_text

Method main_help_text

django/core/management/__init__.py:210–245  ·  view source on GitHub ↗

Return the script's main help text, as a string.

(self, commands_only=False)

Source from the content-addressed store, hash-verified

208 self.settings_exception = None
209
210 def main_help_text(self, commands_only=False):
211 """Return the script's main help text, as a string."""
212 if commands_only:
213 usage = sorted(get_commands())
214 else:
215 usage = [
216 "",
217 "Type '%s help <subcommand>' for help on a specific subcommand."
218 % self.prog_name,
219 "",
220 "Available subcommands:",
221 ]
222 commands_dict = defaultdict(lambda: [])
223 for name, app in get_commands().items():
224 if app == "django.core":
225 app = "django"
226 else:
227 app = app.rpartition(".")[-1]
228 commands_dict[app].append(name)
229 style = color_style()
230 for app in sorted(commands_dict):
231 usage.append("")
232 usage.append(style.NOTICE("[%s]" % app))
233 for name in sorted(commands_dict[app]):
234 usage.append(" %s" % name)
235 # Output an extra note if settings are not properly configured
236 if self.settings_exception is not None:
237 usage.append(
238 style.NOTICE(
239 "Note that only Django core commands are listed "
240 "as settings are not properly configured (error: %s)."
241 % self.settings_exception
242 )
243 )
244
245 return "\n".join(usage)
246
247 def fetch_command(self, subcommand):
248 """

Callers 1

executeMethod · 0.95

Calls 5

color_styleFunction · 0.90
get_commandsFunction · 0.85
itemsMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected