From 682ef819707b1fb2066241c9adb87b2e4c2faf45 Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Mon, 2 Oct 2017 13:27:23 -0700 Subject: [PATCH] bots: zulip_bot_output.py: Use built-in argparse formatting for usage. --- zulip_bots/zulip_bots/zulip_bot_output.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/zulip_bots/zulip_bots/zulip_bot_output.py b/zulip_bots/zulip_bots/zulip_bot_output.py index 43bf65c..5928898 100644 --- a/zulip_bots/zulip_bots/zulip_bot_output.py +++ b/zulip_bots/zulip_bots/zulip_bot_output.py @@ -18,18 +18,17 @@ from zulip_bots.run import import_module_from_source current_dir = os.path.dirname(os.path.abspath(__file__)) def parse_args(): - usage = ''' - zulip-bot-output - Example: zulip-bot-output xkcd "1" - The message need only be enclosed in quotes if empty or containing spaces. - This tool can be used for testing bots by sending simple messages - and capturing the response. - (Internally, this program loads bot-related code from the - library code and then feeds the message provided - in the command to the library code to handle.) - ''' + description = ( + "A tool to test a bot: given a provided message, provides the bot response.\n\n" + 'Example: %(prog)s xkcd "1"') + epilog = ( + "The message need only be enclosed in quotes if empty or containing spaces.\n\n" + "(Internally, this program loads bot-related code from the library code and\n" + "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', action='store', help='the name or path an existing bot to run')