mirror of https://github.com/zulip/zulip.git
python: Elide action="store" for argparse arguments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
1f2ac1962f
commit
fbfd4b399d
|
@ -33,8 +33,7 @@ usage = """Usage: send-receive.py [options] [config]
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(usage=usage)
|
parser = argparse.ArgumentParser(usage=usage)
|
||||||
parser.add_argument('--site',
|
parser.add_argument('--site',
|
||||||
default="https://api.zulip.com",
|
default="https://api.zulip.com")
|
||||||
action='store')
|
|
||||||
|
|
||||||
parser.add_argument('--nagios',
|
parser.add_argument('--nagios',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
|
|
|
@ -18,7 +18,7 @@ from zerver.worker.queue_processors import get_active_worker_queues
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--queue-type', action='store',
|
parser.add_argument('--queue-type',
|
||||||
help="Specify which types of queues to list")
|
help="Specify which types of queues to list")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,7 @@ parser = argparse.ArgumentParser(usage=usage)
|
||||||
parser.add_argument('--min-threshold',
|
parser.add_argument('--min-threshold',
|
||||||
dest='min_count',
|
dest='min_count',
|
||||||
type=int,
|
type=int,
|
||||||
default=1,
|
default=1)
|
||||||
action='store')
|
|
||||||
|
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ parser.add_argument('--force', '-f', action="store_true",
|
||||||
help="Do not prompt with proposed changes")
|
help="Do not prompt with proposed changes")
|
||||||
parser.add_argument('--noop', action="store_true",
|
parser.add_argument('--noop', action="store_true",
|
||||||
help="Do not apply the changes")
|
help="Do not apply the changes")
|
||||||
parser.add_argument('--config', action="store",
|
parser.add_argument('--config',
|
||||||
default="/etc/zulip/zulip.conf",
|
default="/etc/zulip/zulip.conf",
|
||||||
help="Alternate zulip.conf path")
|
help="Alternate zulip.conf path")
|
||||||
args, extra_args = parser.parse_known_args()
|
args, extra_args = parser.parse_known_args()
|
||||||
|
|
|
@ -48,7 +48,6 @@ parser.add_argument('--minify',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Minifies assets for testing in dev')
|
help='Minifies assets for testing in dev')
|
||||||
parser.add_argument('--interface',
|
parser.add_argument('--interface',
|
||||||
action='store',
|
|
||||||
help='Set the IP or hostname for the proxy to listen on')
|
help='Set the IP or hostname for the proxy to listen on')
|
||||||
parser.add_argument('--no-clear-memcached',
|
parser.add_argument('--no-clear-memcached',
|
||||||
action='store_false', dest='clear_memcached',
|
action='store_false', dest='clear_memcached',
|
||||||
|
|
|
@ -223,7 +223,6 @@ def main() -> None:
|
||||||
|
|
||||||
parser.add_argument('--parallel', dest='processes',
|
parser.add_argument('--parallel', dest='processes',
|
||||||
type=int,
|
type=int,
|
||||||
action='store',
|
|
||||||
default=default_parallel,
|
default=default_parallel,
|
||||||
help='Specify the number of processes to run the '
|
help='Specify the number of processes to run the '
|
||||||
'tests in. Default is the number of logical CPUs')
|
'tests in. Default is the number of logical CPUs')
|
||||||
|
|
|
@ -121,10 +121,8 @@ parser.add_argument('--watch',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='watch for changes to source files (for development)')
|
help='watch for changes to source files (for development)')
|
||||||
parser.add_argument('--host',
|
parser.add_argument('--host',
|
||||||
action='store',
|
|
||||||
default='127.0.0.1', help='set the host for the webpack server to run on')
|
default='127.0.0.1', help='set the host for the webpack server to run on')
|
||||||
parser.add_argument('--port',
|
parser.add_argument('--port',
|
||||||
action='store',
|
|
||||||
default='9994', help='set the port for the webpack server to run on')
|
default='9994', help='set the port for the webpack server to run on')
|
||||||
parser.add_argument('--minify',
|
parser.add_argument('--minify',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|
|
@ -38,7 +38,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '../../api'))
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
parser.add_argument('--stream', default='', action="store")
|
parser.add_argument('--stream', default='')
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
client = zulip.init_from_options(options)
|
client = zulip.init_from_options(options)
|
||||||
|
|
|
@ -18,11 +18,9 @@ class Command(BaseCommand):
|
||||||
help="Gitter data in json format")
|
help="Gitter data in json format")
|
||||||
|
|
||||||
parser.add_argument('--output', dest='output_dir',
|
parser.add_argument('--output', dest='output_dir',
|
||||||
action="store",
|
|
||||||
help='Directory to write exported data to.')
|
help='Directory to write exported data to.')
|
||||||
|
|
||||||
parser.add_argument('--threads',
|
parser.add_argument('--threads',
|
||||||
action="store",
|
|
||||||
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
||||||
help='Threads to download avatars and attachments faster')
|
help='Threads to download avatars and attachments faster')
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ class Command(BaseCommand):
|
||||||
help="tar of Hipchat data")
|
help="tar of Hipchat data")
|
||||||
|
|
||||||
parser.add_argument('--output', dest='output_dir',
|
parser.add_argument('--output', dest='output_dir',
|
||||||
action="store",
|
|
||||||
help='Directory to write exported data to.')
|
help='Directory to write exported data to.')
|
||||||
|
|
||||||
parser.add_argument('--mask', dest='masking_content',
|
parser.add_argument('--mask', dest='masking_content',
|
||||||
|
@ -48,7 +47,6 @@ class Command(BaseCommand):
|
||||||
" See import docs for details.")
|
" See import docs for details.")
|
||||||
|
|
||||||
parser.add_argument('--token', dest='api_token',
|
parser.add_argument('--token', dest='api_token',
|
||||||
action="store",
|
|
||||||
help='API token for the HipChat API for fetching subscribers.')
|
help='API token for the HipChat API for fetching subscribers.')
|
||||||
|
|
||||||
parser.formatter_class = argparse.RawTextHelpFormatter
|
parser.formatter_class = argparse.RawTextHelpFormatter
|
||||||
|
|
|
@ -29,7 +29,6 @@ class Command(BaseCommand):
|
||||||
help=dir_help)
|
help=dir_help)
|
||||||
|
|
||||||
parser.add_argument('--output', dest='output_dir',
|
parser.add_argument('--output', dest='output_dir',
|
||||||
action="store",
|
|
||||||
help='Directory to write converted data to.')
|
help='Directory to write converted data to.')
|
||||||
|
|
||||||
parser.add_argument('--mask', dest='masking_content',
|
parser.add_argument('--mask', dest='masking_content',
|
||||||
|
|
|
@ -21,11 +21,9 @@ class Command(BaseCommand):
|
||||||
type=str, help='Slack legacy token of the organsation')
|
type=str, help='Slack legacy token of the organsation')
|
||||||
|
|
||||||
parser.add_argument('--output', dest='output_dir',
|
parser.add_argument('--output', dest='output_dir',
|
||||||
action="store",
|
|
||||||
help='Directory to write exported data to.')
|
help='Directory to write exported data to.')
|
||||||
|
|
||||||
parser.add_argument('--threads',
|
parser.add_argument('--threads',
|
||||||
action="store",
|
|
||||||
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
||||||
help='Threads to use in exporting UserMessage objects in parallel')
|
help='Threads to use in exporting UserMessage objects in parallel')
|
||||||
|
|
||||||
|
|
|
@ -79,10 +79,8 @@ class Command(ZulipBaseCommand):
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('--output',
|
parser.add_argument('--output',
|
||||||
dest='output_dir',
|
dest='output_dir',
|
||||||
action="store",
|
|
||||||
help='Directory to write exported data to.')
|
help='Directory to write exported data to.')
|
||||||
parser.add_argument('--threads',
|
parser.add_argument('--threads',
|
||||||
action="store",
|
|
||||||
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
||||||
help='Threads to use in exporting UserMessage objects in parallel')
|
help='Threads to use in exporting UserMessage objects in parallel')
|
||||||
parser.add_argument('--public-only',
|
parser.add_argument('--public-only',
|
||||||
|
@ -92,7 +90,6 @@ class Command(ZulipBaseCommand):
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help='Deactivate the realm immediately before exporting')
|
help='Deactivate the realm immediately before exporting')
|
||||||
parser.add_argument('--consent-message-id',
|
parser.add_argument('--consent-message-id',
|
||||||
action="store",
|
|
||||||
type=int,
|
type=int,
|
||||||
help='ID of the message advertising users to react with thumbs up')
|
help='ID of the message advertising users to react with thumbs up')
|
||||||
parser.add_argument('--upload',
|
parser.add_argument('--upload',
|
||||||
|
|
|
@ -23,7 +23,6 @@ class Command(ZulipBaseCommand):
|
||||||
help="email of user to export")
|
help="email of user to export")
|
||||||
parser.add_argument('--output',
|
parser.add_argument('--output',
|
||||||
dest='output_dir',
|
dest='output_dir',
|
||||||
action="store",
|
|
||||||
help='Directory to write exported data to.')
|
help='Directory to write exported data to.')
|
||||||
self.add_realm_args(parser)
|
self.add_realm_args(parser)
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,10 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('--path',
|
parser.add_argument('--path',
|
||||||
action="store",
|
|
||||||
help='Path to find messages.json archives')
|
help='Path to find messages.json archives')
|
||||||
parser.add_argument('--thread',
|
parser.add_argument('--thread',
|
||||||
action="store",
|
|
||||||
help='Thread ID')
|
help='Thread ID')
|
||||||
parser.add_argument('--consent-message-id',
|
parser.add_argument('--consent-message-id',
|
||||||
action="store",
|
|
||||||
type=int,
|
type=int,
|
||||||
help='ID of the message advertising users to react with thumbs up')
|
help='ID of the message advertising users to react with thumbs up')
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@ class Command(BaseCommand):
|
||||||
parser.add_argument('app_label', nargs='?',
|
parser.add_argument('app_label', nargs='?',
|
||||||
help='App label of an application to synchronize the state.')
|
help='App label of an application to synchronize the state.')
|
||||||
|
|
||||||
parser.add_argument('--database', action='store',
|
parser.add_argument('--database',
|
||||||
default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. '
|
default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. '
|
||||||
'Defaults to the "default" database.')
|
'Defaults to the "default" database.')
|
||||||
|
|
||||||
parser.add_argument('--output', action='store',
|
parser.add_argument('--output',
|
||||||
help='Path to store the status to (default to stdout).')
|
help='Path to store the status to (default to stdout).')
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: Any) -> None:
|
def handle(self, *args: Any, **options: Any) -> None:
|
||||||
|
|
|
@ -33,7 +33,6 @@ import a database dump from one or more JSON files."""
|
||||||
metavar='<export path>',
|
metavar='<export path>',
|
||||||
help="list of export directories to import")
|
help="list of export directories to import")
|
||||||
parser.add_argument('--processes',
|
parser.add_argument('--processes',
|
||||||
action="store",
|
|
||||||
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
||||||
help='Number of processes to use for uploading Avatars to S3 in parallel')
|
help='Number of processes to use for uploading Avatars to S3 in parallel')
|
||||||
parser.formatter_class = argparse.RawTextHelpFormatter
|
parser.formatter_class = argparse.RawTextHelpFormatter
|
||||||
|
|
|
@ -24,7 +24,6 @@ ONLY perform this on customer request from an authorized person.
|
||||||
action="store_false",
|
action="store_false",
|
||||||
help='Remove an administrator\'s rights.')
|
help='Remove an administrator\'s rights.')
|
||||||
parser.add_argument('--permission',
|
parser.add_argument('--permission',
|
||||||
action="store",
|
|
||||||
default='administer',
|
default='administer',
|
||||||
choices=['administer', 'api_super_user'],
|
choices=['administer', 'api_super_user'],
|
||||||
help='Permission to grant/remove.')
|
help='Permission to grant/remove.')
|
||||||
|
|
|
@ -11,7 +11,6 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
def add_arguments(self, parser: CommandParser) -> None:
|
def add_arguments(self, parser: CommandParser) -> None:
|
||||||
parser.add_argument('--processes',
|
parser.add_argument('--processes',
|
||||||
action="store",
|
|
||||||
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
default=settings.DEFAULT_DATA_EXPORT_IMPORT_PARALLELISM,
|
||||||
help='Processes to use for exporting uploads in parallel')
|
help='Processes to use for exporting uploads in parallel')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue