mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-07 15:38:11 +08:00
Replace optparse with argparse
This commit is contained in:
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user