1
0
mirror of https://github.com/django/django.git synced 2024-12-23 17:46:27 +00:00
django/tests/user_commands/management/commands/subparser_required.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
513 B
Python
Raw Normal View History

from django.core.management.base import BaseCommand
class Command(BaseCommand):
def add_arguments(self, parser):
subparsers_1 = parser.add_subparsers(dest="subcommand_1")
parser_foo_1 = subparsers_1.add_parser("foo_1")
subparsers_2 = parser_foo_1.add_subparsers(dest="subcommand_2")
parser_foo_2 = subparsers_2.add_parser("foo_2")
parser_foo_2.add_argument("--bar", required=True)
def handle(self, *args, **options):
self.stdout.write(",".join(options))