Add support for positional app_label and migration_name arguments

This commit is contained in:
David Wobrock committed 2021-05-26 18:53:19 +02:00
1 parent bf525ae79d
commit 6d595f1555
3 files changed
+37 -7

No files matched your search

@@ -26,6 +26,18 @@ class Command(BaseCommand):
help = "Lint your migrations"
def add_arguments(self, parser):
parser.add_argument(
"app_label",
nargs="?",
type=str,
help="App label of an application to lint migrations.",
)
parser.add_argument(
"migration_name",
nargs="?",
type=str,
help="Linting will only be done on that migration only.",
)
parser.add_argument(
"--git-commit-id",
type=str,
@@ -191,6 +203,8 @@ class Command(BaseCommand):
warnings_as_errors=config["warnings_as_errors"],
)
linter.lint_all_migrations(
app_label=options["app_label"],
migration_name=options["migration_name"],
git_commit_id=options["git_commit_id"],
migrations_file_path=options["include_migrations_from"],
)