diff options
author | Maxime “pep” Buquet <pep@bouah.net> | 2020-09-04 09:29:19 +0200 |
---|---|---|
committer | Maxime “pep” Buquet <pep@bouah.net> | 2020-09-04 09:29:19 +0200 |
commit | fe960cb825c9188dd726630c6c79c0003ba3a629 (patch) | |
tree | 5ae20a82bd2b866fce5d418529295607966334a0 /plugins | |
parent | c7a46f17126a34fb10194114c831f635c325866b (diff) | |
download | poezio-fe960cb825c9188dd726630c6c79c0003ba3a629.tar.gz poezio-fe960cb825c9188dd726630c6c79c0003ba3a629.tar.bz2 poezio-fe960cb825c9188dd726630c6c79c0003ba3a629.tar.xz poezio-fe960cb825c9188dd726630c6c79c0003ba3a629.zip |
plugins/code: Prevent traceback when not enough arguments -- thanks Ge0rG
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/code.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/code.py b/plugins/code.py index 1c6dfab0..8d9c57a3 100644 --- a/plugins/code.py +++ b/plugins/code.py @@ -41,7 +41,11 @@ class Plugin(BasePlugin): help='Sends syntax-highlighted code in the current tab') def command_code(self, args): - language, code = args.split(None, 1) + split = args.split(None, 1) + if len(split) != 2: + self.api.information('Usage: /code <language> <code>', 'Error') + return None + language, code = split lexer = get_lexer_by_name(language) tab = self.api.current_tab() code = highlight(code, lexer, FORMATTER) |