tests/user_commands/management/commands/mutually_exclusive_required_with_same_dest.py
raw| 1 | from django.core.management.base import BaseCommand |
| 2 | |
| 3 | |
| 4 | class Command(BaseCommand): |
| 5 | def add_arguments(self, parser): |
| 6 | group = parser.add_mutually_exclusive_group(required=True) |
| 7 | group.add_argument("--for", dest="until", action="store") |
| 8 | group.add_argument("--until", action="store") |
| 9 | |
| 10 | def handle(self, *args, **options): |
| 11 | for option, value in options.items(): |
| 12 | if value is not None: |
| 13 | self.stdout.write("%s=%s" % (option, value)) |