parent
5a426fa841
commit
6db062ef75
|
@ -33,6 +33,7 @@ import optparse
|
|||
import argparse
|
||||
import platform
|
||||
import random
|
||||
import types
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from six.moves.configparser import SafeConfigParser
|
||||
|
@ -104,8 +105,15 @@ def _default_client():
|
|||
# type: () -> str
|
||||
return "ZulipPython/" + __version__
|
||||
|
||||
def add_default_arguments(parser):
|
||||
def add_default_arguments(parser, patch_error_handling=True):
|
||||
# type: (argparse.ArgumentParser) -> argparse.ArgumentParser
|
||||
|
||||
if patch_error_handling:
|
||||
def custom_error_handling(self, message):
|
||||
self.print_help(sys.stderr)
|
||||
self.exit(2, '{}: error: {}\n'.format(self.prog, message))
|
||||
parser.error = types.MethodType(custom_error_handling, parser)
|
||||
|
||||
group = parser.add_argument_group('Zulip API configuration')
|
||||
group.add_argument('--site',
|
||||
dest="zulip_site",
|
||||
|
|
Loading…
Reference in a new issue