Some style changes to help/error messages.

This commit is contained in:
Denis Kasak 2018-02-28 17:53:03 +01:00 committed by poljar
parent 23df2d4bcb
commit a73c887ee3

View file

@ -54,7 +54,7 @@ def hook_commands():
' reconnect: reconnect to server(s)\n\n' ' reconnect: reconnect to server(s)\n\n'
' help: show detailed command help\n\n' ' help: show detailed command help\n\n'
' debug: enable or disable debugging\n\n' ' debug: enable or disable debugging\n\n'
'Use /matrix help [command] to find out more\n'), 'Use /matrix help [command] to find out more.\n'),
# Completions # Completions
('server %(matrix_server_commands)|%* ||' ('server %(matrix_server_commands)|%* ||'
'connect %(matrix_servers) ||' 'connect %(matrix_servers) ||'
@ -350,8 +350,7 @@ def matrix_redact_command_cb(data, buffer, args):
matches = re.match(r"(\d+)(:\".*\")? ?(.*)?", args) matches = re.match(r"(\d+)(:\".*\")? ?(.*)?", args)
if not matches: if not matches:
message = ("{prefix}matrix: Invalid command arguments (see " message = ("{prefix}matrix: Invalid command arguments (see /help redact)"
"the help for the command /help redact)"
).format(prefix=W.prefix("error")) ).format(prefix=W.prefix("error"))
W.prnt("", message) W.prnt("", message)
return W.WEECHAT_RC_ERROR return W.WEECHAT_RC_ERROR
@ -390,8 +389,8 @@ def matrix_redact_command_cb(data, buffer, args):
def matrix_command_debug(args): def matrix_command_debug(args):
if not args: if not args:
message = ("{prefix}matrix: Too few arguments for command " message = ("{prefix}matrix: Too few arguments for command "
"\"/matrix debug\" (see the help for the command: " "\"/matrix debug\" (see /matrix help debug)"
"/matrix help debug").format(prefix=W.prefix("error")) ).format(prefix=W.prefix("error"))
W.prnt("", message) W.prnt("", message)
return return
@ -426,8 +425,8 @@ def matrix_command_debug(args):
def matrix_command_help(args): def matrix_command_help(args):
if not args: if not args:
message = ("{prefix}matrix: Too few arguments for command " message = ("{prefix}matrix: Too few arguments for command "
"\"/matrix help\" (see the help for the command: " "\"/matrix help\" (see /matrix help help)"
"/matrix help help").format(prefix=W.prefix("error")) ).format(prefix=W.prefix("error"))
W.prnt("", message) W.prnt("", message)
return return
@ -666,14 +665,14 @@ def matrix_server_command_delete(args):
def matrix_server_command_add(args): def matrix_server_command_add(args):
if len(args) < 2: if len(args) < 2:
message = ("{prefix}matrix: Too few arguments for command " message = ("{prefix}matrix: Too few arguments for command "
"\"/matrix server add\" (see the help for the command: " "\"/matrix server add\" (see /matrix help server)"
"/matrix help server").format(prefix=W.prefix("error")) ).format(prefix=W.prefix("error"))
W.prnt("", message) W.prnt("", message)
return return
elif len(args) > 4: elif len(args) > 4:
message = ("{prefix}matrix: Too many arguments for command " message = ("{prefix}matrix: Too many arguments for command "
"\"/matrix server add\" (see the help for the command: " "\"/matrix server add\" (see /matrix help server)"
"/matrix help server").format(prefix=W.prefix("error")) ).format(prefix=W.prefix("error"))
W.prnt("", message) W.prnt("", message)
return return
@ -828,8 +827,7 @@ def matrix_command_cb(data, buffer, args):
if len(split_args) < 1: if len(split_args) < 1:
message = ("{prefix}matrix: Too few arguments for command " message = ("{prefix}matrix: Too few arguments for command "
"\"/matrix\" (see the help for the command: " "\"/matrix\" (see /help matrix)").format(prefix=W.prefix("error"))
"/help matrix").format(prefix=W.prefix("error"))
W.prnt("", message) W.prnt("", message)
return W.WEECHAT_RC_ERROR return W.WEECHAT_RC_ERROR