diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-03-29 20:31:19 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-03-29 20:31:19 +0100 |
commit | f1d18f4c26b6dd72286f86b93da25567d932b6e4 (patch) | |
tree | 35c02cc32c1e3488a6702e489812e48ceae2bbc3 /src/core | |
parent | fa5b1eed77d6b012ab440f0bd75e1b155985e671 (diff) | |
download | weechat-f1d18f4c26b6dd72286f86b93da25567d932b6e4.zip |
core: use seconds by default in /repeat interval, allow unit for the interval
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-command.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 325e24753..dc92ca8ea 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -5250,7 +5250,8 @@ command_repeat_timer_cb (const void *pointer, void *data, int remaining_calls) COMMAND_CALLBACK(repeat) { - int arg_count, count, interval, i; + int arg_count, count, i; + long interval; char *error, **repeat_args; /* make C compiler happy */ @@ -5264,9 +5265,8 @@ COMMAND_CALLBACK(repeat) if ((argc >= 5) && (string_strcasecmp (argv[1], "-interval") == 0)) { - error = NULL; - interval = (int)strtol (argv[2], &error, 10); - if (!error || error[0] || (interval < 1)) + interval = util_parse_delay (argv[2], 1000); + if (interval < 1) interval = 0; arg_count = 3; } @@ -7906,8 +7906,13 @@ command_init () hook_command ( NULL, "repeat", N_("execute a command several times"), - N_("[-interval <delay>] <count> <command>"), - N_(" delay: delay between execution of commands (in milliseconds)\n" + N_("[-interval <delay>[<unit>]] <count> <command>"), + N_(" delay: delay between execution of commands\n" + " unit: optional, values are:\n" + " ms: milliseconds\n" + " s: seconds (default)\n" + " m: minutes\n" + " h: hours\n" " count: number of times to execute command\n" "command: command to execute (or text to send to buffer if command " "does not start with '/')\n" |