plugins/code: Prevent traceback when not enough arguments -- thanks Ge0rG
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
c7a46f1712
commit
fe960cb825
1 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue