Ticket #28398: candidate-commands.diff

File candidate-commands.diff, 1.2 KB (added by Vlada Macek, 22 months ago)

a patch

  • ./django/core/management/__init__.

    old new  
    191191                # (get_commands() swallows the original one) so the user is
    192192                # informed about it.
    193193                settings.INSTALLED_APPS
    194194            else:
    195195                sys.stderr.write("No Django settings specified.\n")
     196            style = color_style()
     197            candidates = "  ".join(cmd for cmd in sorted(commands) if subcommand in cmd)
     198            if candidates:
     199                candidates = "%s:  %s\n" % (style.SUCCESS("Possible candidates"), candidates)
    196200            sys.stderr.write(
    197                 "Unknown command: %r\nType '%s help' for usage.\n"
    198                 % (subcommand, self.prog_name)
     201                "%s: %r\n%sOr type '%s help' for full usage.\n"
     202                % (style.NOTICE("Unknown command"), subcommand,
     203                   candidates, self.prog_name)
    199204            )
    200205            sys.exit(1)
    201206        if isinstance(app_name, BaseCommand):
    202207            # If the command is already loaded, use it directly.
    203208            klass = app_name
Back to Top