Replace optparse with argparse

This commit is contained in:
Dan Bright
2016-06-09 12:46:06 +01:00
parent d66209de29
commit 515447d999
+15 -15
View File
@@ -1,7 +1,4 @@
from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django_q import VERSION from django_q import VERSION
@@ -13,18 +10,21 @@ class Command(BaseCommand):
# Translators: help text for qinfo management command # Translators: help text for qinfo management command
help = _('General information over all clusters.') help = _('General information over all clusters.')
option_list = BaseCommand.option_list + ( def add_arguments(self, parser):
make_option('--config', parser.add_argument(
action='store_true', '--config',
dest='config', action='store_true',
default=False, dest='config',
help='Print current configuration.'), default=False,
make_option('--ids', help='Print current configuration.',
action='store_true', )
dest='ids', parser.add_argument(
default=False, '--ids',
help='Print cluster task IDs (PIDs).'), action='store_true',
) dest='ids',
default=False,
help='Print cluster task ID(s) (PIDs).',
)
def handle(self, *args, **options): def handle(self, *args, **options):
if options.get('ids', True): if options.get('ids', True):