1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 05:16:38 +02:00

core: add option "-s" in command /eval to split commands (no more split by default) (closes #324)

This commit is contained in:
Sébastien Helleu
2015-01-30 08:58:37 +01:00
parent d3c309c787
commit 5e2cd75efc
14 changed files with 76 additions and 35 deletions
+2
View File
@@ -19,6 +19,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
=== New features
* core: add option "-s" in command /eval to split commands (no more split by
default) (closes #324)
* irc: add support of "account-notify" capability (closes #11, closes #246)
* irc: remove server "freenode" from default config file (closes #309)
* irc: add support of "ecdsa-nist256p-challenge" SASL mechanism (closes #251)
+3 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1395,11 +1395,12 @@ msgstr ""
msgid "evaluate expression"
msgstr ""
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr ""
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+5 -2
View File
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2015-01-25 18:35+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <>\n"
@@ -1471,11 +1471,14 @@ msgstr ""
msgid "evaluate expression"
msgstr "evaluierter Ausdruck"
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
#, fuzzy
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
#, fuzzy
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+3 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1433,11 +1433,12 @@ msgstr ""
msgid "evaluate expression"
msgstr ""
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr ""
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+8 -4
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"PO-Revision-Date: 2015-01-29 07:43+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2015-01-30 08:26+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -1444,11 +1444,13 @@ msgstr ""
msgid "evaluate expression"
msgstr "évaluer une expression"
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr "[-n] <expression> || [-n] -c <expression1> <opérateur> <expression2>"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr ""
"[-n|-s] <expression> || [-n] -c <expression1> <opérateur> <expression2>"
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
@@ -1518,6 +1520,8 @@ msgid ""
" /eval -n -c abcd !~ abc ==> 0"
msgstr ""
" -n : afficher le résultat sans envoyer au tampon (mode debug)\n"
" -s : découper l'expression (plusieurs commandes peuvent être "
"séparées par des points-virgules)\n"
" -c : évaluer comme une condition : utiliser les opérateurs et les "
"parenthèses, retourner une valeur booléenne (\"0\" ou \"1\")\n"
"expression : expression à évaluer, les variables avec le format ${variable} "
+3 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1326,11 +1326,12 @@ msgstr ""
msgid "evaluate expression"
msgstr ""
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr ""
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+4 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1412,13 +1412,15 @@ msgstr ""
msgid "evaluate expression"
msgstr ""
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
#, fuzzy
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr ""
"[-n] <espressione> || [-n] -c <espressione1> <operatore> <espressione2>"
#, fuzzy
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+5 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2015-01-25 13:54+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n"
@@ -1410,11 +1410,14 @@ msgstr ""
msgid "evaluate expression"
msgstr "式を評価"
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
#, fuzzy
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
#, fuzzy
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+5 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2014-12-26 19:51+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1447,11 +1447,14 @@ msgstr ""
msgid "evaluate expression"
msgstr "przetwórz wyrażenie"
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
#, fuzzy
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr "[-n] <wyrażenie> || [-n] -c <wyrażenie1> <operator> <wyrażenie2>"
#, fuzzy
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+3 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1451,11 +1451,12 @@ msgstr ""
msgid "evaluate expression"
msgstr ""
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr ""
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+3 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1348,11 +1348,12 @@ msgstr ""
msgid "evaluate expression"
msgstr ""
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr ""
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+3 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2014-07-25 07:50+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1183,11 +1183,12 @@ msgstr ""
msgid "evaluate expression"
msgstr ""
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr ""
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+3 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-01-29 07:42+0100\n"
"POT-Creation-Date: 2015-01-30 08:25+0100\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1185,11 +1185,12 @@ msgstr ""
msgid "evaluate expression"
msgstr ""
msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr ""
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression (many commands can be separated by semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, return a "
"boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format ${variable} are "
+26 -9
View File
@@ -1815,7 +1815,7 @@ COMMAND_CALLBACK(debug)
COMMAND_CALLBACK(eval)
{
int i, print_only, condition;
int i, print_only, split_command, condition;
char *result, *ptr_args, *expr, **commands;
struct t_hashtable *pointers, *options;
@@ -1824,6 +1824,7 @@ COMMAND_CALLBACK(eval)
(void) argv;
print_only = 0;
split_command = 0;
condition = 0;
COMMAND_MIN_ARGS(2, "");
@@ -1836,6 +1837,11 @@ COMMAND_CALLBACK(eval)
print_only = 1;
ptr_args = argv_eol[i + 1];
}
else if (string_strcasecmp (argv[i], "-s") == 0)
{
split_command = 1;
ptr_args = argv_eol[i + 1];
}
else if (string_strcasecmp (argv[i], "-c") == 0)
{
condition = 1;
@@ -1906,14 +1912,21 @@ COMMAND_CALLBACK(eval)
result = eval_expression (ptr_args, pointers, NULL, options);
if (result)
{
commands = string_split_command (result, ';');
if (commands)
if (split_command)
{
for (i = 0; commands[i]; i++)
commands = string_split_command (result, ';');
if (commands)
{
(void) input_data (buffer, commands[i]);
for (i = 0; commands[i]; i++)
{
(void) input_data (buffer, commands[i]);
}
string_free_split_command (commands);
}
string_free_split_command (commands);
}
else
{
(void) input_data (buffer, result);
}
}
else
@@ -7105,8 +7118,12 @@ command_init ()
hook_command (
NULL, "eval",
N_("evaluate expression"),
N_("[-n] <expression> || [-n] -c <expression1> <operator> <expression2>"),
N_(" -n: display result without sending it to buffer (debug mode)\n"
N_("[-n|-s] <expression>"
" || [-n] -c <expression1> <operator> <expression2>"),
N_(" -n: display result without sending it to buffer "
"(debug mode)\n"
" -s: split expression (many commands can be separated by "
"semicolons)\n"
" -c: evaluate as condition: use operators and parentheses, "
"return a boolean value (\"0\" or \"1\")\n"
"expression: expression to evaluate, variables with format "
@@ -7178,7 +7195,7 @@ command_init ()
" /eval -n -c abcd =~ (?-i)^ABC ==> 0\n"
" /eval -n -c abcd =~ (?-i)^abc ==> 1\n"
" /eval -n -c abcd !~ abc ==> 0"),
"-n|-c -n|-c",
"-n|-s|-c -n|-s|-c",
&command_eval, NULL);
hook_command (
NULL, "filter",