mirror of
https://github.com/zulip/zulip.git
synced 2025-10-28 02:23:57 +00:00
python: Elide type=str from argparse arguments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Alex Vandiver
parent
fbfd4b399d
commit
a50fae89e2
@@ -14,7 +14,6 @@ class Command(BaseCommand):
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help="Actually do it.")
|
help="Actually do it.")
|
||||||
parser.add_argument('--property',
|
parser.add_argument('--property',
|
||||||
type=str,
|
|
||||||
help="The property of the stat to be cleared.")
|
help="The property of the stat to be cleared.")
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: Any) -> None:
|
def handle(self, *args: Any, **options: Any) -> None:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Command(BaseCommand):
|
|||||||
help = "Generate statistics on the streams for a realm."
|
help = "Generate statistics on the streams for a realm."
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('realms', metavar='<realm>', type=str, nargs='*',
|
parser.add_argument('realms', metavar='<realm>', nargs='*',
|
||||||
help="realm to generate statistics for")
|
help="realm to generate statistics for")
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: str) -> None:
|
def handle(self, *args: Any, **options: str) -> None:
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('--time', '-t',
|
parser.add_argument('--time', '-t',
|
||||||
type=str,
|
|
||||||
help='Update stat tables from current state to'
|
help='Update stat tables from current state to'
|
||||||
'--time. Defaults to the current time.',
|
'--time. Defaults to the current time.',
|
||||||
default=timezone_now().isoformat())
|
default=timezone_now().isoformat())
|
||||||
@@ -31,7 +30,6 @@ class Command(BaseCommand):
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help="Interpret --time in UTC.")
|
help="Interpret --time in UTC.")
|
||||||
parser.add_argument('--stat', '-s',
|
parser.add_argument('--stat', '-s',
|
||||||
type=str,
|
|
||||||
help="CountStat to process. If omitted, all stats are processed.")
|
help="CountStat to process. If omitted, all stats are processed.")
|
||||||
parser.add_argument('--verbose',
|
parser.add_argument('--verbose',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|||||||
@@ -54,17 +54,17 @@ from urllib.request import Request, urlopen
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
parser.add_argument('-r', '--recipient', type=str, default='',
|
parser.add_argument('-r', '--recipient', default='',
|
||||||
help="Original recipient.")
|
help="Original recipient.")
|
||||||
|
|
||||||
parser.add_argument('-s', '--shared-secret', type=str, default='',
|
parser.add_argument('-s', '--shared-secret', default='',
|
||||||
help="Secret access key.")
|
help="Secret access key.")
|
||||||
|
|
||||||
parser.add_argument('-d', '--dst-host', dest="host", type=str, default='https://127.0.0.1',
|
parser.add_argument('-d', '--dst-host', dest="host", default='https://127.0.0.1',
|
||||||
help="Destination server address for uploading email from email mirror. "
|
help="Destination server address for uploading email from email mirror. "
|
||||||
"Address must contain a HTTP protocol.")
|
"Address must contain a HTTP protocol.")
|
||||||
|
|
||||||
parser.add_argument('-u', '--dst-url', dest="url", type=str, default='/email_mirror_message',
|
parser.add_argument('-u', '--dst-url', dest="url", default='/email_mirror_message',
|
||||||
help="Destination relative url for uploading email from email mirror.")
|
help="Destination relative url for uploading email from email mirror.")
|
||||||
|
|
||||||
parser.add_argument('-n', '--not-verify-ssl', dest="verify_ssl", action='store_false',
|
parser.add_argument('-n', '--not-verify-ssl', dest="verify_ssl", action='store_false',
|
||||||
|
|||||||
@@ -194,16 +194,16 @@ def generate_screenshot_from_config(integration_name: str, screenshot_config: Sc
|
|||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
group = parser.add_mutually_exclusive_group(required=True)
|
group = parser.add_mutually_exclusive_group(required=True)
|
||||||
group.add_argument('--all', action='store_true')
|
group.add_argument('--all', action='store_true')
|
||||||
group.add_argument('--integration', type=str, help='Name of the integration')
|
group.add_argument('--integration', help='Name of the integration')
|
||||||
parser.add_argument('--fixture', type=str, help='Name of the fixture file to use')
|
parser.add_argument('--fixture', help='Name of the fixture file to use')
|
||||||
parser.add_argument('--image-name', type=str, help='Name for the screenshot image')
|
parser.add_argument('--image-name', help='Name for the screenshot image')
|
||||||
parser.add_argument('--image-dir', type=str, help='Directory name where to save the screenshot image')
|
parser.add_argument('--image-dir', help='Directory name where to save the screenshot image')
|
||||||
parser.add_argument('--bot-name', type=str, help='Name to use for the bot')
|
parser.add_argument('--bot-name', help='Name to use for the bot')
|
||||||
parser.add_argument('-A', '--use-basic-auth', action='store_true',
|
parser.add_argument('-A', '--use-basic-auth', action='store_true',
|
||||||
help='Add basic auth headers to the request')
|
help='Add basic auth headers to the request')
|
||||||
parser.add_argument('-Q', '--payload-as-query-param', action='store_true',
|
parser.add_argument('-Q', '--payload-as-query-param', action='store_true',
|
||||||
help='Send payload as query param instead of body')
|
help='Send payload as query param instead of body')
|
||||||
parser.add_argument('-P', '--payload-param-name', type=str,
|
parser.add_argument('-P', '--payload-param-name',
|
||||||
help='Param name to use for the payload')
|
help='Param name to use for the payload')
|
||||||
parser.add_argument('-H', '--custom-headers',
|
parser.add_argument('-H', '--custom-headers',
|
||||||
type=custom_headers,
|
type=custom_headers,
|
||||||
|
|||||||
@@ -79,11 +79,11 @@ def main() -> None:
|
|||||||
"takes the path of output csv file and path to `emoji_names.py` as arguments.")
|
"takes the path of output csv file and path to `emoji_names.py` as arguments.")
|
||||||
parser = argparse.ArgumentParser(description=description)
|
parser = argparse.ArgumentParser(description=description)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--input-file", dest="input_file_path", type=str, metavar="<path>",
|
"--input-file", dest="input_file_path", metavar="<path>",
|
||||||
default=os.path.join(TOOLS_DIR_PATH, "setup", "emoji", "emoji_names.py"),
|
default=os.path.join(TOOLS_DIR_PATH, "setup", "emoji", "emoji_names.py"),
|
||||||
help="Path to the file from which data is to be read.")
|
help="Path to the file from which data is to be read.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--output-file", dest="output_file_path", type=str, metavar="<path>",
|
"--output-file", dest="output_file_path", metavar="<path>",
|
||||||
default=os.path.join(TOOLS_DIR_PATH, "setup", "emoji", "emoji_names.csv"),
|
default=os.path.join(TOOLS_DIR_PATH, "setup", "emoji", "emoji_names.csv"),
|
||||||
help="Path to the output csv file.")
|
help="Path to the output csv file.")
|
||||||
|
|
||||||
|
|||||||
@@ -86,11 +86,11 @@ def main() -> None:
|
|||||||
"file path.")
|
"file path.")
|
||||||
parser = argparse.ArgumentParser(description=description)
|
parser = argparse.ArgumentParser(description=description)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--input-file", dest="input_file_path", type=str, metavar="<path>",
|
"--input-file", dest="input_file_path", metavar="<path>",
|
||||||
default=os.path.join(EMOJI_DIR_PATH, "emoji_names.csv"),
|
default=os.path.join(EMOJI_DIR_PATH, "emoji_names.csv"),
|
||||||
help="Path to the csv file from which data is to be read.")
|
help="Path to the csv file from which data is to be read.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--output-file", dest="output_file_path", type=str, metavar="<path>",
|
"--output-file", dest="output_file_path", metavar="<path>",
|
||||||
default=os.path.join(EMOJI_DIR_PATH, "emoji_names.py"),
|
default=os.path.join(EMOJI_DIR_PATH, "emoji_names.py"),
|
||||||
help="Path to the output file.")
|
help="Path to the output file.")
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ def main() -> None:
|
|||||||
"and then verifying that no changes were made in the process.")
|
"and then verifying that no changes were made in the process.")
|
||||||
parser = argparse.ArgumentParser(description=description)
|
parser = argparse.ArgumentParser(description=description)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--input-file", dest="input_file_path", type=str, metavar="<path>",
|
"--input-file", dest="input_file_path", metavar="<path>",
|
||||||
default=os.path.join(TOOLS_DIR, "setup", "emoji", "emoji_names.csv"),
|
default=os.path.join(TOOLS_DIR, "setup", "emoji", "emoji_names.csv"),
|
||||||
help="Path to the CSV file to be used for round-trip conversion.")
|
help="Path to the CSV file to be used for round-trip conversion.")
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ sys.path.insert(0, ZULIP_PATH)
|
|||||||
from scripts.lib.zulip_tools import is_vagrant_env_host
|
from scripts.lib.zulip_tools import is_vagrant_env_host
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument('path', metavar='FILE', type=str, nargs='+',
|
parser.add_argument('path', metavar='FILE', nargs='+',
|
||||||
help='config file of dummy users in development server')
|
help='config file of dummy users in development server')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ You can use the command list_realms to find ID of the realms in this server."""
|
|||||||
'-r', '--realm',
|
'-r', '--realm',
|
||||||
dest='realm_id',
|
dest='realm_id',
|
||||||
required=required,
|
required=required,
|
||||||
type=str,
|
|
||||||
help=help)
|
help=help)
|
||||||
|
|
||||||
def add_user_list_args(self, parser: ArgumentParser,
|
def add_user_list_args(self, parser: ArgumentParser,
|
||||||
@@ -59,7 +58,6 @@ You can use the command list_realms to find ID of the realms in this server."""
|
|||||||
all_users_help: str="All users in realm.") -> None:
|
all_users_help: str="All users in realm.") -> None:
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-u', '--users',
|
'-u', '--users',
|
||||||
type=str,
|
|
||||||
help=help)
|
help=help)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
@@ -16,13 +16,10 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
def add_arguments(self, parser: argparse.ArgumentParser) -> None:
|
def add_arguments(self, parser: argparse.ArgumentParser) -> None:
|
||||||
parser.add_argument('--api-key',
|
parser.add_argument('--api-key',
|
||||||
type=str,
|
|
||||||
help='MailChimp API key.')
|
help='MailChimp API key.')
|
||||||
parser.add_argument('--list-id',
|
parser.add_argument('--list-id',
|
||||||
type=str,
|
|
||||||
help='List ID of the MailChimp mailing list.')
|
help='List ID of the MailChimp mailing list.')
|
||||||
parser.add_argument('--optin-time',
|
parser.add_argument('--optin-time',
|
||||||
type=str,
|
|
||||||
default=datetime.isoformat(timezone_now().replace(microsecond=0)),
|
default=datetime.isoformat(timezone_now().replace(microsecond=0)),
|
||||||
help='Opt-in time of the users.')
|
help='Opt-in time of the users.')
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ class Command(ZulipBaseCommand):
|
|||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-s', '--streams',
|
'-s', '--streams',
|
||||||
type=str,
|
|
||||||
required=True,
|
required=True,
|
||||||
help='A comma-separated list of stream names.')
|
help='A comma-separated list of stream names.')
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Command(ZulipBaseCommand):
|
|||||||
help = """Change the names for many users."""
|
help = """Change the names for many users."""
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('data_file', metavar='<data file>', type=str,
|
parser.add_argument('data_file', metavar='<data file>',
|
||||||
help="file containing rows of the form <email>,<desired name>")
|
help="file containing rows of the form <email>,<desired name>")
|
||||||
self.add_realm_args(parser, True)
|
self.add_realm_args(parser, True)
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ class Command(ZulipBaseCommand):
|
|||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
self.add_realm_args(parser)
|
self.add_realm_args(parser)
|
||||||
parser.add_argument('old_email', metavar='<old email>', type=str,
|
parser.add_argument('old_email', metavar='<old email>',
|
||||||
help='email address to change')
|
help='email address to change')
|
||||||
parser.add_argument('new_email', metavar='<new email>', type=str,
|
parser.add_argument('new_email', metavar='<new email>',
|
||||||
help='new email address')
|
help='new email address')
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: str) -> None:
|
def handle(self, *args: Any, **options: str) -> None:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Command(BaseCommand):
|
|||||||
help="Zipped slack data")
|
help="Zipped slack data")
|
||||||
|
|
||||||
parser.add_argument('--token', metavar='<slack_token>',
|
parser.add_argument('--token', metavar='<slack_token>',
|
||||||
type=str, help='Slack legacy token of the organsation')
|
help='Slack legacy token of the organsation')
|
||||||
|
|
||||||
parser.add_argument('--output', dest='output_dir',
|
parser.add_argument('--output', dest='output_dir',
|
||||||
help='Directory to write exported data to.')
|
help='Directory to write exported data to.')
|
||||||
|
|||||||
@@ -18,21 +18,18 @@ Create default stream groups which the users can choose during sign up.
|
|||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-n', '--name',
|
'-n', '--name',
|
||||||
type=str,
|
|
||||||
required=True,
|
required=True,
|
||||||
help='Name of the group you want to create.',
|
help='Name of the group you want to create.',
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-d', '--description',
|
'-d', '--description',
|
||||||
type=str,
|
|
||||||
required=True,
|
required=True,
|
||||||
help='Description of the group.',
|
help='Description of the group.',
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-s', '--streams',
|
'-s', '--streams',
|
||||||
type=str,
|
|
||||||
required=True,
|
required=True,
|
||||||
help='A comma-separated list of stream names.')
|
help='A comma-separated list of stream names.')
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ the command."""
|
|||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
self.add_realm_args(parser, True, "realm in which to create the stream")
|
self.add_realm_args(parser, True, "realm in which to create the stream")
|
||||||
parser.add_argument('stream_name', metavar='<stream name>', type=str,
|
parser.add_argument('stream_name', metavar='<stream name>',
|
||||||
help='name of stream to create')
|
help='name of stream to create')
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: str) -> None:
|
def handle(self, *args: Any, **options: str) -> None:
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ Omit both <email> and <full name> for interactive user creation.
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help='Acknowledgement that the user has already accepted the ToS.')
|
help='Acknowledgement that the user has already accepted the ToS.')
|
||||||
parser.add_argument('--password',
|
parser.add_argument('--password',
|
||||||
type=str,
|
|
||||||
default='',
|
default='',
|
||||||
help='password of new user. For development only.'
|
help='password of new user. For development only.'
|
||||||
'Note that we recommend against setting '
|
'Note that we recommend against setting '
|
||||||
@@ -34,12 +33,11 @@ Omit both <email> and <full name> for interactive user creation.
|
|||||||
'on the server via `ps -ef` or by any superuser with'
|
'on the server via `ps -ef` or by any superuser with'
|
||||||
'read access to the user\'s bash history.')
|
'read access to the user\'s bash history.')
|
||||||
parser.add_argument('--password-file',
|
parser.add_argument('--password-file',
|
||||||
type=str,
|
|
||||||
default='',
|
default='',
|
||||||
help='The file containing the password of the new user.')
|
help='The file containing the password of the new user.')
|
||||||
parser.add_argument('email', metavar='<email>', type=str, nargs='?', default=argparse.SUPPRESS,
|
parser.add_argument('email', metavar='<email>', nargs='?', default=argparse.SUPPRESS,
|
||||||
help='email address of new user')
|
help='email address of new user')
|
||||||
parser.add_argument('full_name', metavar='<full name>', type=str, nargs='?',
|
parser.add_argument('full_name', metavar='<full name>', nargs='?',
|
||||||
default=argparse.SUPPRESS,
|
default=argparse.SUPPRESS,
|
||||||
help='full name of new user')
|
help='full name of new user')
|
||||||
self.add_realm_args(parser, True, "The name of the existing realm to which to add the user.")
|
self.add_realm_args(parser, True, "The name of the existing realm to which to add the user.")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Command(ZulipBaseCommand):
|
|||||||
parser.add_argument('-f', '--for-real',
|
parser.add_argument('-f', '--for-real',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Actually deactivate the user. Default is a dry run.")
|
help="Actually deactivate the user. Default is a dry run.")
|
||||||
parser.add_argument('email', metavar='<email>', type=str,
|
parser.add_argument('email', metavar='<email>',
|
||||||
help='email of user to deactivate')
|
help='email of user to deactivate')
|
||||||
self.add_realm_args(parser)
|
self.add_realm_args(parser)
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ You can use "-" to represent stdin.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('queue_name', metavar='<queue>', type=str,
|
parser.add_argument('queue_name', metavar='<queue>',
|
||||||
help="name of worker queue to enqueue to")
|
help="name of worker queue to enqueue to")
|
||||||
parser.add_argument('file_name', metavar='<file>', type=str,
|
parser.add_argument('file_name', metavar='<file>',
|
||||||
help="name of file containing JSON lines")
|
help="name of file containing JSON lines")
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: str) -> None:
|
def handle(self, *args: Any, **options: str) -> None:
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Command(ZulipBaseCommand):
|
|||||||
with (for example) any bots owned by the user."""
|
with (for example) any bots owned by the user."""
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('email', metavar='<email>', type=str,
|
parser.add_argument('email', metavar='<email>',
|
||||||
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',
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ class Command(ZulipBaseCommand):
|
|||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('emails',
|
parser.add_argument('emails',
|
||||||
metavar='<emails>',
|
metavar='<emails>',
|
||||||
type=str,
|
|
||||||
nargs='*',
|
nargs='*',
|
||||||
help='email address to spelunk')
|
help='email address to spelunk')
|
||||||
parser.add_argument('--all',
|
parser.add_argument('--all',
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class Command(ZulipBaseCommand):
|
|||||||
parser.add_argument('--force',
|
parser.add_argument('--force',
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help='Override that the domain is restricted to external users.')
|
help='Override that the domain is restricted to external users.')
|
||||||
parser.add_argument('emails', metavar='<email>', type=str, nargs='*',
|
parser.add_argument('emails', metavar='<email>', nargs='*',
|
||||||
help='email of users to generate an activation link for')
|
help='email of users to generate an activation link for')
|
||||||
self.add_realm_args(parser, True)
|
self.add_realm_args(parser, True)
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,10 @@ class Command(ZulipBaseCommand):
|
|||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-s', '--streams',
|
'-s', '--streams',
|
||||||
type=str,
|
|
||||||
help='A comma-separated list of stream names.')
|
help='A comma-separated list of stream names.')
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--referred-by',
|
'--referred-by',
|
||||||
type=str,
|
|
||||||
help='Email of referrer',
|
help='Email of referrer',
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import a database dump from one or more JSON files."""
|
|||||||
help='Import into an existing nonempty database.')
|
help='Import into an existing nonempty database.')
|
||||||
|
|
||||||
parser.add_argument('subdomain', metavar='<subdomain>',
|
parser.add_argument('subdomain', metavar='<subdomain>',
|
||||||
type=str, help="Subdomain")
|
help="Subdomain")
|
||||||
|
|
||||||
parser.add_argument('export_paths', nargs='+',
|
parser.add_argument('export_paths', nargs='+',
|
||||||
metavar='<export path>',
|
metavar='<export path>',
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ ONLY perform this on customer request from an authorized person.
|
|||||||
default='administer',
|
default='administer',
|
||||||
choices=['administer', 'api_super_user'],
|
choices=['administer', 'api_super_user'],
|
||||||
help='Permission to grant/remove.')
|
help='Permission to grant/remove.')
|
||||||
parser.add_argument('email', metavar='<email>', type=str,
|
parser.add_argument('email', metavar='<email>',
|
||||||
help="email of user to knight")
|
help="email of user to knight")
|
||||||
self.add_realm_args(parser, True)
|
self.add_realm_args(parser, True)
|
||||||
|
|
||||||
|
|||||||
@@ -74,13 +74,13 @@ class Command(makemessages.Command):
|
|||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
super().add_arguments(parser)
|
super().add_arguments(parser)
|
||||||
parser.add_argument('--frontend-source', type=str,
|
parser.add_argument('--frontend-source',
|
||||||
default='static/templates',
|
default='static/templates',
|
||||||
help='Name of the Handlebars template directory')
|
help='Name of the Handlebars template directory')
|
||||||
parser.add_argument('--frontend-output', type=str,
|
parser.add_argument('--frontend-output',
|
||||||
default='locale',
|
default='locale',
|
||||||
help='Name of the frontend messages output directory')
|
help='Name of the frontend messages output directory')
|
||||||
parser.add_argument('--frontend-namespace', type=str,
|
parser.add_argument('--frontend-namespace',
|
||||||
default='translations.json',
|
default='translations.json',
|
||||||
help='Namespace of the frontend locale file')
|
help='Namespace of the frontend locale file')
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ class Command(ZulipBaseCommand):
|
|||||||
help = """Merge two streams."""
|
help = """Merge two streams."""
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('stream_to_keep', type=str,
|
parser.add_argument('stream_to_keep',
|
||||||
help='name of stream to keep')
|
help='name of stream to keep')
|
||||||
parser.add_argument('stream_to_destroy', type=str,
|
parser.add_argument('stream_to_destroy',
|
||||||
help='name of stream to merge into the stream being kept')
|
help='name of stream to merge into the stream being kept')
|
||||||
self.add_realm_args(parser, True)
|
self.add_realm_args(parser, True)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from zerver.worker.queue_processors import get_active_worker_queues, get_worker
|
|||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('--queue_name', metavar='<queue name>', type=str,
|
parser.add_argument('--queue_name', metavar='<queue name>',
|
||||||
help="queue to process")
|
help="queue to process")
|
||||||
parser.add_argument('--worker_num', metavar='<worker number>', type=int, default=0,
|
parser.add_argument('--worker_num', metavar='<worker number>', type=int, default=0,
|
||||||
help="worker label")
|
help="worker label")
|
||||||
@@ -23,7 +23,7 @@ class Command(BaseCommand):
|
|||||||
help="run all queues")
|
help="run all queues")
|
||||||
parser.add_argument('--multi_threaded', nargs='+',
|
parser.add_argument('--multi_threaded', nargs='+',
|
||||||
metavar='<list of queue name>',
|
metavar='<list of queue name>',
|
||||||
type=str, required=False,
|
required=False,
|
||||||
help="list of queue to process")
|
help="list of queue to process")
|
||||||
|
|
||||||
help = "Runs a queue processing worker"
|
help = "Runs a queue processing worker"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from zerver.worker.queue_processors import get_active_worker_queues
|
|||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument(dest="queue_name", type=str, nargs='?',
|
parser.add_argument(dest="queue_name", nargs='?',
|
||||||
help="queue to purge")
|
help="queue to purge")
|
||||||
parser.add_argument('--all', action="store_true",
|
parser.add_argument('--all', action="store_true",
|
||||||
help="purge all queues")
|
help="purge all queues")
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from zproject.backends import query_ldap
|
|||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('email', metavar='<email>', type=str,
|
parser.add_argument('email', metavar='<email>',
|
||||||
help="email of user to query")
|
help="email of user to query")
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: str) -> None:
|
def handle(self, *args: Any, **options: str) -> None:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Command(ZulipBaseCommand):
|
|||||||
dest='bots',
|
dest='bots',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Whether or not to also block all bots for this user.")
|
help="Whether or not to also block all bots for this user.")
|
||||||
parser.add_argument('operation', metavar='<operation>', type=str, choices=['block', 'unblock'],
|
parser.add_argument('operation', metavar='<operation>', choices=['block', 'unblock'],
|
||||||
help="operation to perform (block or unblock)")
|
help="operation to perform (block or unblock)")
|
||||||
self.add_realm_args(parser)
|
self.add_realm_args(parser)
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,12 @@ class Command(ZulipBaseCommand):
|
|||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('--op',
|
parser.add_argument('--op',
|
||||||
type=str,
|
|
||||||
default="show",
|
default="show",
|
||||||
help='What operation to do (add, show, remove).')
|
help='What operation to do (add, show, remove).')
|
||||||
parser.add_argument('--allow-subdomains',
|
parser.add_argument('--allow-subdomains',
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help='Whether subdomains are allowed or not.')
|
help='Whether subdomains are allowed or not.')
|
||||||
parser.add_argument('domain', metavar='<domain>', type=str, nargs='?',
|
parser.add_argument('domain', metavar='<domain>', nargs='?',
|
||||||
help="domain to add or remove")
|
help="domain to add or remove")
|
||||||
self.add_realm_args(parser, True)
|
self.add_realm_args(parser, True)
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,11 @@ Example: ./manage.py realm_filters --realm=zulip --op=show
|
|||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('--op',
|
parser.add_argument('--op',
|
||||||
type=str,
|
|
||||||
default="show",
|
default="show",
|
||||||
help='What operation to do (add, show, remove).')
|
help='What operation to do (add, show, remove).')
|
||||||
parser.add_argument('pattern', metavar='<pattern>', type=str, nargs='?',
|
parser.add_argument('pattern', metavar='<pattern>', nargs='?',
|
||||||
help="regular expression to match")
|
help="regular expression to match")
|
||||||
parser.add_argument('url_format_string', metavar='<url pattern>', type=str, nargs='?',
|
parser.add_argument('url_format_string', metavar='<url pattern>', nargs='?',
|
||||||
help="format string to substitute")
|
help="format string to substitute")
|
||||||
self.add_realm_args(parser, True)
|
self.add_realm_args(parser, True)
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ class Command(ZulipBaseCommand):
|
|||||||
def add_arguments(self, parser: CommandParser) -> None:
|
def add_arguments(self, parser: CommandParser) -> None:
|
||||||
parser.add_argument('-s', '--stream',
|
parser.add_argument('-s', '--stream',
|
||||||
required=True,
|
required=True,
|
||||||
type=str,
|
|
||||||
help='A stream name.')
|
help='A stream name.')
|
||||||
|
|
||||||
self.add_realm_args(parser, True)
|
self.add_realm_args(parser, True)
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ class Command(ZulipBaseCommand):
|
|||||||
help = """Change the stream name for a realm."""
|
help = """Change the stream name for a realm."""
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('old_name', metavar='<old name>', type=str,
|
parser.add_argument('old_name', metavar='<old name>',
|
||||||
help='name of stream to be renamed')
|
help='name of stream to be renamed')
|
||||||
parser.add_argument('new_name', metavar='<new name>', type=str,
|
parser.add_argument('new_name', metavar='<new name>',
|
||||||
help='new name to rename the stream to')
|
help='new name to rename the stream to')
|
||||||
self.add_realm_args(parser, True)
|
self.add_realm_args(parser, True)
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Command(BaseCommand):
|
|||||||
help = "Starts a Tornado Web server wrapping Django."
|
help = "Starts a Tornado Web server wrapping Django."
|
||||||
|
|
||||||
def add_arguments(self, parser: CommandParser) -> None:
|
def add_arguments(self, parser: CommandParser) -> None:
|
||||||
parser.add_argument('addrport', nargs="?", type=str,
|
parser.add_argument('addrport', nargs="?",
|
||||||
help='[optional port number or ipaddr:port]\n '
|
help='[optional port number or ipaddr:port]\n '
|
||||||
'(use multiple ports to start multiple servers)')
|
'(use multiple ports to start multiple servers)')
|
||||||
|
|
||||||
|
|||||||
@@ -20,16 +20,12 @@ class Command(ZulipBaseCommand):
|
|||||||
help="Send to every user on the server.")
|
help="Send to every user on the server.")
|
||||||
parser.add_argument('--markdown-template-path', '--path',
|
parser.add_argument('--markdown-template-path', '--path',
|
||||||
required=True,
|
required=True,
|
||||||
type=str,
|
|
||||||
help='Path to a Markdown-format body for the email.')
|
help='Path to a Markdown-format body for the email.')
|
||||||
parser.add_argument('--subject',
|
parser.add_argument('--subject',
|
||||||
type=str,
|
|
||||||
help='Subject for the email. It can be declared in Markdown file in headers')
|
help='Subject for the email. It can be declared in Markdown file in headers')
|
||||||
parser.add_argument('--from-name',
|
parser.add_argument('--from-name',
|
||||||
type=str,
|
|
||||||
help='From line for the email. It can be declared in Markdown file in headers')
|
help='From line for the email. It can be declared in Markdown file in headers')
|
||||||
parser.add_argument('--reply-to',
|
parser.add_argument('--reply-to',
|
||||||
type=str,
|
|
||||||
help='Optional reply-to line for the email')
|
help='Optional reply-to line for the email')
|
||||||
parser.add_argument('--admins-only',
|
parser.add_argument('--admins-only',
|
||||||
help='Send only to organization administrators',
|
help='Send only to organization administrators',
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ class Command(BaseCommand):
|
|||||||
help = """Send some stats to statsd."""
|
help = """Send some stats to statsd."""
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('operation', metavar='<operation>', type=str,
|
parser.add_argument('operation', metavar='<operation>',
|
||||||
choices=['incr', 'decr', 'timing', 'timer', 'gauge'],
|
choices=['incr', 'decr', 'timing', 'timer', 'gauge'],
|
||||||
help="incr|decr|timing|timer|gauge")
|
help="incr|decr|timing|timer|gauge")
|
||||||
parser.add_argument('name', metavar='<name>', type=str)
|
parser.add_argument('name', metavar='<name>')
|
||||||
parser.add_argument('val', metavar='<val>', type=str)
|
parser.add_argument('val', metavar='<val>')
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: str) -> None:
|
def handle(self, *args: Any, **options: str) -> None:
|
||||||
operation = options['operation']
|
operation = options['operation']
|
||||||
|
|||||||
@@ -37,13 +37,11 @@ Example:
|
|||||||
|
|
||||||
def add_arguments(self, parser: CommandParser) -> None:
|
def add_arguments(self, parser: CommandParser) -> None:
|
||||||
parser.add_argument('-f', '--fixture',
|
parser.add_argument('-f', '--fixture',
|
||||||
type=str,
|
|
||||||
help='The path to the email message you\'d like to send '
|
help='The path to the email message you\'d like to send '
|
||||||
'to the email mirror.\n'
|
'to the email mirror.\n'
|
||||||
'Accepted formats: json or raw email file. '
|
'Accepted formats: json or raw email file. '
|
||||||
'See zerver/tests/fixtures/email/ for examples')
|
'See zerver/tests/fixtures/email/ for examples')
|
||||||
parser.add_argument('-s', '--stream',
|
parser.add_argument('-s', '--stream',
|
||||||
type=str,
|
|
||||||
help='The name of the stream to which you\'d like to send '
|
help='The name of the stream to which you\'d like to send '
|
||||||
'the message. Default: Denmark')
|
'the message. Default: Denmark')
|
||||||
|
|
||||||
|
|||||||
@@ -32,17 +32,14 @@ approach shown above.
|
|||||||
|
|
||||||
def add_arguments(self, parser: CommandParser) -> None:
|
def add_arguments(self, parser: CommandParser) -> None:
|
||||||
parser.add_argument('-f', '--fixture',
|
parser.add_argument('-f', '--fixture',
|
||||||
type=str,
|
|
||||||
help='The path to the fixture you\'d like to send '
|
help='The path to the fixture you\'d like to send '
|
||||||
'into Zulip')
|
'into Zulip')
|
||||||
|
|
||||||
parser.add_argument('-u', '--url',
|
parser.add_argument('-u', '--url',
|
||||||
type=str,
|
|
||||||
help='The url on your Zulip server that you want '
|
help='The url on your Zulip server that you want '
|
||||||
'to post the fixture to')
|
'to post the fixture to')
|
||||||
|
|
||||||
parser.add_argument('-H', '--custom-headers',
|
parser.add_argument('-H', '--custom-headers',
|
||||||
type=str,
|
|
||||||
help='The headers you want to provide along with '
|
help='The headers you want to provide along with '
|
||||||
'your mock request to Zulip.')
|
'your mock request to Zulip.')
|
||||||
|
|
||||||
|
|||||||
@@ -20,20 +20,16 @@ class Command(ZulipBaseCommand):
|
|||||||
help="Actually change message flags. Default is a dry run.")
|
help="Actually change message flags. Default is a dry run.")
|
||||||
|
|
||||||
parser.add_argument('-f', '--flag',
|
parser.add_argument('-f', '--flag',
|
||||||
type=str,
|
|
||||||
help="The flag to add of remove")
|
help="The flag to add of remove")
|
||||||
|
|
||||||
parser.add_argument('-o', '--op',
|
parser.add_argument('-o', '--op',
|
||||||
type=str,
|
|
||||||
help="The operation to do: 'add' or 'remove'")
|
help="The operation to do: 'add' or 'remove'")
|
||||||
|
|
||||||
parser.add_argument('-u', '--until',
|
parser.add_argument('-u', '--until',
|
||||||
dest='all_until',
|
dest='all_until',
|
||||||
type=str,
|
|
||||||
help="Mark all messages <= specific usermessage id")
|
help="Mark all messages <= specific usermessage id")
|
||||||
|
|
||||||
parser.add_argument('-m', '--email',
|
parser.add_argument('-m', '--email',
|
||||||
type=str,
|
|
||||||
help="Email to set messages for")
|
help="Email to set messages for")
|
||||||
self.add_realm_args(parser)
|
self.add_realm_args(parser)
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Command(ZulipBaseCommand):
|
|||||||
type=int,
|
type=int,
|
||||||
default=28,
|
default=28,
|
||||||
help='Number of days of inactivity before soft-deactivation')
|
help='Number of days of inactivity before soft-deactivation')
|
||||||
parser.add_argument('users', metavar='<users>', type=str, nargs='*', default=[],
|
parser.add_argument('users', metavar='<users>', nargs='*', default=[],
|
||||||
help="A list of user emails to soft activate/deactivate.")
|
help="A list of user emails to soft activate/deactivate.")
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: Any) -> None:
|
def handle(self, *args: Any, **options: Any) -> None:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class Command(ZulipBaseCommand):
|
|||||||
fmt = '%-30s %-16s %-32s'
|
fmt = '%-30s %-16s %-32s'
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('emails', metavar='<email>', type=str, nargs='*',
|
parser.add_argument('emails', metavar='<email>', nargs='*',
|
||||||
help="email of user to show password and API key for")
|
help="email of user to show password and API key for")
|
||||||
self.add_realm_args(parser)
|
self.add_realm_args(parser)
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ def profile_request(request: HttpRequest) -> HttpResponse:
|
|||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
def add_arguments(self, parser: CommandParser) -> None:
|
def add_arguments(self, parser: CommandParser) -> None:
|
||||||
parser.add_argument("email", metavar="<email>", type=str, help="Email address of the user")
|
parser.add_argument("email", metavar="<email>", help="Email address of the user")
|
||||||
self.add_realm_args(parser)
|
self.add_realm_args(parser)
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: Any) -> None:
|
def handle(self, *args: Any, **options: Any) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user