bots: zulip_bot_output.py: Use built-in argparse formatting for usage.
This commit is contained in:
parent
7835f1cc19
commit
682ef81970
|
@ -18,18 +18,17 @@ from zulip_bots.run import import_module_from_source
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
usage = '''
|
description = (
|
||||||
zulip-bot-output <bot_name> <message>
|
"A tool to test a bot: given a provided message, provides the bot response.\n\n"
|
||||||
Example: zulip-bot-output xkcd "1"
|
'Example: %(prog)s xkcd "1"')
|
||||||
The message need only be enclosed in quotes if empty or containing spaces.
|
epilog = (
|
||||||
This tool can be used for testing bots by sending simple messages
|
"The message need only be enclosed in quotes if empty or containing spaces.\n\n"
|
||||||
and capturing the response.
|
"(Internally, this program loads bot-related code from the library code and\n"
|
||||||
(Internally, this program loads bot-related code from the
|
"then feeds the message provided in the command to the library code to handle.)")
|
||||||
library code and then feeds the message provided
|
|
||||||
in the command to the library code to handle.)
|
|
||||||
'''
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(usage=usage)
|
parser = argparse.ArgumentParser(description=description,
|
||||||
|
epilog=epilog,
|
||||||
|
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
parser.add_argument('bot',
|
parser.add_argument('bot',
|
||||||
action='store',
|
action='store',
|
||||||
help='the name or path an existing bot to run')
|
help='the name or path an existing bot to run')
|
||||||
|
|
Loading…
Reference in a new issue