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

exec: add options "-rc"/"-norc" (display return code) in command /exec

This commit is contained in:
Sebastien Helleu
2014-03-13 07:56:20 +01:00
parent 571a7a5dbe
commit 0eca1fd20b
4 changed files with 21 additions and 4 deletions
+14 -2
View File
@@ -255,6 +255,14 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
{
cmd_options->line_numbers = 0;
}
else if (weechat_strcasecmp (argv[i], "-rc") == 0)
{
cmd_options->display_rc = 1;
}
else if (weechat_strcasecmp (argv[i], "-norc") == 0)
{
cmd_options->display_rc = 0;
}
else if (weechat_strcasecmp (argv[i], "-timeout") == 0)
{
if (i + 1 >= argc)
@@ -318,6 +326,7 @@ exec_command_run (struct t_gui_buffer *buffer,
cmd_options.new_buffer = 0;
cmd_options.switch_to_buffer = 1;
cmd_options.line_numbers = -1;
cmd_options.display_rc = 1;
cmd_options.ptr_command_name = NULL;
/* parse default options */
@@ -429,6 +438,7 @@ exec_command_run (struct t_gui_buffer *buffer,
}
new_exec_cmd->line_numbers = (cmd_options.line_numbers < 0) ?
cmd_options.new_buffer : cmd_options.line_numbers;
new_exec_cmd->display_rc = cmd_options.display_rc;
/* execute the command */
if (weechat_exec_plugin->debug >= 1)
@@ -659,8 +669,8 @@ exec_command_init ()
N_("execute external commands"),
N_("-list"
" || [-sh|-nosh] [-bg|-nobg] [-stdin|-nostdin] [-buffer <name>] "
"[-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-timeout <timeout>] "
"[-name <name>] <command>"
"[-l|-o|-n] |-sw|-nosw] [-ln|-noln] [-rc|-norc] "
"[-timeout <timeout>] [-name <name>] <command>"
" || -in <id> <text>"
" || -inclose <id> [<text>]"
" || -signal <id> <signal>"
@@ -691,6 +701,8 @@ exec_command_init ()
" -nosw: don't switch to the output buffer\n"
" -ln: display line numbers (default in new buffer only)\n"
" -noln: don't display line numbers\n"
" -rc: display return code (default)\n"
" -norc: don't display return code\n"
"-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; if beginning with \"url:\", the "