plugins/code: Prevent traceback when not enough arguments -- thanks Ge0rG

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent c7a46f17
Pipeline #3336 passed with stages
in 5 minutes and 55 seconds
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment