Skip to content

Commit

Permalink
修复(help):当 help xxx 为未定义的命令时程序崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
zombie110year committed Sep 1, 2020
1 parent 88f3f98 commit 3aaf543
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cli_cqu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def help_command(self, command: Optional[str]):
if isinstance(action, _SubParsersAction)
][0]
cmdaction = cmdparser.choices.get(command)
print(cmdaction.format_help())
if cmdaction is not None:
print(cmdaction.format_help())
else:
print(self._cmdparser.format_help())

def courses_json(self, filename: str):
"""选择课程表,下载为 JSON 文件"""
Expand Down

0 comments on commit 3aaf543

Please sign in to comment.