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/mutually_exclusive_required.py

13 lines
423 B
Python

from django.core.management.base import BaseCommand
class Command(BaseCommand):
def add_arguments(self, parser):
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--foo-id', type=int, nargs='?', default=None)
group.add_argument('--foo-name', type=str, nargs='?', default=None)
def handle(self, *args, **options):
self.stdout.write(','.join(options))