From e3de3e6dda9a945c1d7e6991dc36a22c6bbd3947 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 11 Mar 2014 11:45:19 +0100 Subject: [PATCH] exec: add option "-set" in command /exec --- src/plugins/exec/exec-command.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/plugins/exec/exec-command.c b/src/plugins/exec/exec-command.c index d50afd206..229682a6c 100644 --- a/src/plugins/exec/exec-command.c +++ b/src/plugins/exec/exec-command.c @@ -247,6 +247,17 @@ exec_command_exec (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } + /* set a hook property */ + if (weechat_strcasecmp (argv[1], "-set") == 0) + { + if (argc < 5) + return WEECHAT_RC_ERROR; + ptr_exec_cmd = exec_command_search_running_id (argv[2]); + if (ptr_exec_cmd) + weechat_hook_set (ptr_exec_cmd->hook, argv[3], argv_eol[4]); + return WEECHAT_RC_OK; + } + /* parse command options */ command_index = -1; use_shell = 1; @@ -383,7 +394,8 @@ exec_command_init () " || -in " " || -signal " " || -kill " - " || -killall"), + " || -killall" + " || -set "), N_(" -list: list commands\n" " -nosh: do not use the shell to execute the command (required if " "the command has some unsafe data, for example the content of a " @@ -394,16 +406,21 @@ exec_command_init () "-timeout: set a timeout for the command (in seconds)\n" " -name: set a name for the command (to name it later with /exec)\n" " command: the command to execute\n" + " id: command identifier: either its number or name (if set " + "with \"-name xxx\")" " -in: send text on standard input of process\n" " -signal: send a signal to the process; the signal can be an integer " "or one of these names: hup, int, quit, kill, term, usr1, usr2\n" " -kill: alias of \"-signal kill\"\n" "-killall: kill all running processes\n" - " id: command identifier: either its number or name (if set " - "with \"-name xxx\")"), + " -set: set a hook property (see function hook_set in plugin API " + "reference)\n" + "property: property for function hook_set\n" + " value: new value for property"), "-list" " || -nosh|-stdin|-o|-timeout|-name|%*" " || -in|-signal|-kill %(exec_commands_ids)" - " || -killall", + " || -killall" + " || -set %(exec_commands_ids) stdin|stdin_close|signal", &exec_command_exec, NULL); }