From 98b67ad8292221c1623d94e94abb91dc3b0ee41b Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Tue, 2 Feb 2021 12:39:23 +0800 Subject: [PATCH] :memo: update docstring --- docs/api/rule.md | 2 +- nonebot/exception.py | 6 ++++++ nonebot/rule.py | 2 +- tests/test_plugins/test_shell.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/api/rule.md b/docs/api/rule.md index 25a9fe13..5c3dfbed 100644 --- a/docs/api/rule.md +++ b/docs/api/rule.md @@ -215,7 +215,7 @@ Rule(async_function, run_sync(sync_function)) from nonebot.rule import ArgumentParser parser = ArgumentParser() -parser.add_argument("-a", type=bool) +parser.add_argument("-a", action="store_true") rule = shell_command("ls", parser=parser) ``` diff --git a/nonebot/exception.py b/nonebot/exception.py index b8a42aa4..7eaab701 100644 --- a/nonebot/exception.py +++ b/nonebot/exception.py @@ -53,6 +53,12 @@ class ParserExit(NoneBotException): self.status = status self.message = message + def __repr__(self): + return f"" + + def __str__(self): + return self.__repr__() + class PausedException(NoneBotException): """ diff --git a/nonebot/rule.py b/nonebot/rule.py index eb00de57..d9f75a24 100644 --- a/nonebot/rule.py +++ b/nonebot/rule.py @@ -326,7 +326,7 @@ def shell_command(*cmds: Union[str, Tuple[str, ...]], from nonebot.rule import ArgumentParser parser = ArgumentParser() - parser.add_argument("-a", type=bool) + parser.add_argument("-a", action="store_true") rule = shell_command("ls", parser=parser) diff --git a/tests/test_plugins/test_shell.py b/tests/test_plugins/test_shell.py index 5afebd6d..63719b42 100644 --- a/tests/test_plugins/test_shell.py +++ b/tests/test_plugins/test_shell.py @@ -4,7 +4,7 @@ from nonebot import on_shell_command from nonebot.rule import to_me, ArgumentParser parser = ArgumentParser() -parser.add_argument("-a", type=bool) +parser.add_argument("-a", action="store_true") shell = on_shell_command("ls", to_me(), parser=parser)