exec: add option exec.command.shell to customize the shell used with /exec -sh

v2.8-utf8proc
Sébastien Helleu 2018-11-17 11:39:28 +01:00
parent c94a8f4c68
commit 916d99ad40
23 changed files with 163 additions and 18 deletions

View File

@ -24,6 +24,7 @@ New features::
* api: add functions string_base_encode and string_base_decode, remove functions string_encode_base64 and string_decode_base64
* api: add support of Time-based One-Time Password (TOTP), add infos "totp_generate" and "totp_validate"
* buflist: add variable ${number2}, always set with the indented buffer number
* exec: add option exec.command.shell to customize the shell used with /exec -sh
* relay: add support of close frame in websocket connection (issue #1281)
* relay: add support of Time-based One-Time Password (TOTP) as second authentication factor in weechat protocol

View File

@ -25,3 +25,9 @@
** Typ: integer
** Werte: -1 .. 25920000
** Standardwert: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
** Beschreibung: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash")]
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette
** Standardwert: `+"sh"+`

View File

@ -25,3 +25,9 @@
** type: integer
** values: -1 .. 25920000
** default value: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
** description: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash")]
** type: string
** values: any string
** default value: `+"sh"+`

View File

@ -25,3 +25,9 @@
** type: entier
** valeurs: -1 .. 25920000
** valeur par défaut: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
** description: pass:none[shell à utiliser avec la commande "/exec -sh" ; cela peut être seulement le nom du shell s'il est dans le PATH (par exemple "bash") ou le chemin absolu vers le shell (par exemple "/bin/bash")]
** type: chaîne
** valeurs: toute chaîne
** valeur par défaut: `+"sh"+`

View File

@ -25,3 +25,9 @@
** tipo: intero
** valori: -1 .. 25920000
** valore predefinito: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
** descrizione: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash")]
** tipo: stringa
** valori: qualsiasi stringa
** valore predefinito: `+"sh"+`

View File

@ -25,3 +25,9 @@
** タイプ: 整数
** 値: -1 .. 25920000
** デフォルト値: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
** 説明: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash")]
** タイプ: 文字列
** 値: 未制約文字列
** デフォルト値: `+"sh"+`

View File

@ -25,3 +25,9 @@
** typ: liczba
** wartości: -1 .. 25920000
** domyślna wartość: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
** opis: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash")]
** typ: ciąg
** wartości: dowolny ciąg
** domyślna wartość: `+"sh"+`

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5472,6 +5472,12 @@ msgid ""
"immediately, -1 = never purge)"
msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
#, fuzzy
msgid "text color for a running command flag in list of commands"
msgstr "barva textu pro akce ve vstupní řádce"

View File

@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 11:04+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -6676,6 +6676,12 @@ msgstr ""
"Wartezeit bis nicht mehr ausgeführte Befehle gelöscht werden (in Sekunden, 0 "
"= lösche Befehle unmittelbar, -1 = niemals löschen)"
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
msgid "text color for a running command flag in list of commands"
msgstr ""
"Textfarbe des Statusindikator (in der Auflistung der Befehle) für Befehle "

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5687,6 +5687,12 @@ msgid ""
"immediately, -1 = never purge)"
msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
#, fuzzy
msgid "text color for a running command flag in list of commands"
msgstr "color para acciones en la línea de entrada"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"PO-Revision-Date: 2018-11-17 10:35+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 11:37+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -6513,6 +6513,15 @@ msgstr ""
"délai pour purger les commandes terminées (en secondes, 0 = purger les "
"commandes immédiatement, -1 = ne jamais purger)"
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
"shell à utiliser avec la commande \"/exec -sh\" ; cela peut être seulement "
"le nom du shell s'il est dans le PATH (par exemple \"bash\") ou le chemin "
"absolu vers le shell (par exemple \"/bin/bash\")"
msgid "text color for a running command flag in list of commands"
msgstr ""
"couleur du texte pour le drapeau d'une commande qui tourne dans la liste des "

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5001,6 +5001,12 @@ msgid ""
"immediately, -1 = never purge)"
msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
#, fuzzy
msgid "text color for a running command flag in list of commands"
msgstr "kilépési nyíl színe"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5856,6 +5856,12 @@ msgid ""
"immediately, -1 = never purge)"
msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
#, fuzzy
msgid "text color for a running command flag in list of commands"
msgstr "colore del testo per le azioni sulla riga di input"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -6228,6 +6228,12 @@ msgstr ""
"接続を切ったクライアントを追い出すまでの遅延時間 (秒単位、0 = すぐにクライア"
"ントを追い出す、-1 = 追い出さない)"
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
msgid "text color for a running command flag in list of commands"
msgstr "コマンドリストで使う実行中コマンドのフラグに対するテキスト色"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@ -6357,6 +6357,12 @@ msgstr ""
"opóźnienie dla kasowania zakończonych komend (w sekundach, 0 = natychmiast, "
"-1 = nigdy)"
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
msgid "text color for a running command flag in list of commands"
msgstr "kolor dla flagi wykonywanej komendy na liście komend"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -6209,6 +6209,12 @@ msgstr ""
"atraso para purgar comandos concluídos (em segundos, 0 = eliminar comandos "
"imediatamente, -1 = nunca eliminar)"
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
msgid "text color for a running command flag in list of commands"
msgstr "cor do texto do sinalizador de comando a executar na lista de comandos"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5650,6 +5650,12 @@ msgid ""
"immediately, -1 = never purge)"
msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
#, fuzzy
msgid "text color for a running command flag in list of commands"
msgstr "cor de texto para ações de linha de entrada"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5039,6 +5039,12 @@ msgid ""
"immediately, -1 = never purge)"
msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
#, fuzzy
msgid "text color for a running command flag in list of commands"
msgstr "цвет действий в поле ввода"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4592,6 +4592,12 @@ msgid ""
"immediately, -1 = never purge)"
msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
#, fuzzy
msgid "text color for a running command flag in list of commands"
msgstr "kanal isimleri için metin rengi"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-11-17 08:09+0100\n"
"POT-Creation-Date: 2018-11-17 11:35+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"
@ -4573,6 +4573,12 @@ msgid ""
"immediately, -1 = never purge)"
msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
"example \"/bin/bash\")"
msgstr ""
msgid "text color for a running command flag in list of commands"
msgstr ""

View File

@ -405,7 +405,8 @@ int
exec_command_run (struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol, int start_arg)
{
char str_buffer[512];
char str_buffer[512], *default_shell = "sh";
const char *ptr_shell;
struct t_exec_cmd *new_exec_cmd;
struct t_exec_cmd_options cmd_options;
struct t_hashtable *process_options;
@ -480,6 +481,19 @@ exec_command_run (struct t_gui_buffer *buffer,
/* automatically disable shell if we are downloading an URL */
if (strncmp (argv_eol[cmd_options.command_index], "url:", 4) == 0)
cmd_options.use_shell = 0;
/* get default shell */
if (cmd_options.use_shell)
{
ptr_shell = weechat_config_string (exec_config_command_shell);
if (!ptr_shell || !ptr_shell[0])
ptr_shell = default_shell;
}
else
{
ptr_shell = NULL;
}
if (cmd_options.use_shell)
{
/* command will be: sh -c "command arguments..." */
@ -574,14 +588,15 @@ exec_command_run (struct t_gui_buffer *buffer,
/* execute the command */
if (weechat_exec_plugin->debug >= 1)
{
weechat_printf (NULL, "%s: executing command: \"%s%s%s\"",
weechat_printf (NULL, "%s: executing command: \"%s%s%s%s\"",
EXEC_PLUGIN_NAME,
(cmd_options.use_shell) ? "sh -c '" : "",
(cmd_options.use_shell) ? ptr_shell : "",
(cmd_options.use_shell) ? " -c '" : "",
argv_eol[cmd_options.command_index],
(cmd_options.use_shell) ? "'" : "");
}
new_exec_cmd->hook = weechat_hook_process_hashtable (
(cmd_options.use_shell) ? "sh" : argv_eol[cmd_options.command_index],
(cmd_options.use_shell) ? ptr_shell : argv_eol[cmd_options.command_index],
process_options,
cmd_options.timeout * 1000,
&exec_process_cb,

View File

@ -34,6 +34,7 @@ struct t_config_file *exec_config_file = NULL;
struct t_config_option *exec_config_command_default_options;
struct t_config_option *exec_config_command_purge_delay;
struct t_config_option *exec_config_command_shell;
/* exec config, color section */
@ -130,6 +131,16 @@ exec_config_init ()
"commands immediately, -1 = never purge)"),
NULL, -1, 36000 * 24 * 30, "0", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
exec_config_command_shell = weechat_config_new_option (
exec_config_file, ptr_section,
"shell", "string",
N_("shell to use with command \"/exec -sh\"; it can be just the name "
"of shell if it is in PATH (for example \"bash\") or the absolute "
"path to the shell (for example \"/bin/bash\")"),
NULL, 0, 0, "sh", NULL, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* color */
ptr_section = weechat_config_new_section (exec_config_file, "color",

View File

@ -26,6 +26,7 @@ extern struct t_config_file *exec_config_file;
extern struct t_config_option *exec_config_command_default_options;
extern struct t_config_option *exec_config_command_purge_delay;
extern struct t_config_option *exec_config_command_shell;
extern struct t_config_option *exec_config_color_flag_running;
extern struct t_config_option *exec_config_color_flag_finished;