diff options
author | Thomas Adam <thomas@xteddy.org> | 2021-08-25 12:01:11 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2021-08-25 12:01:11 +0100 |
commit | c6375a0d4003d1008bb64e96e9c0c4433e4a5d13 (patch) | |
tree | ac84b463df1f905b68cfce14c68a1bfe3d543b05 /cmd-if-shell.c | |
parent | 6616b42b2c28cd7a1b6d52dfc895f5a1d3dce8b3 (diff) | |
parent | 24636be42b4b0463afe5c72e1d982f28729a0579 (diff) | |
download | rtmux-c6375a0d4003d1008bb64e96e9c0c4433e4a5d13.tar.gz rtmux-c6375a0d4003d1008bb64e96e9c0c4433e4a5d13.tar.bz2 rtmux-c6375a0d4003d1008bb64e96e9c0c4433e4a5d13.zip |
Merge branch 'obsd-master' into master
Diffstat (limited to 'cmd-if-shell.c')
-rw-r--r-- | cmd-if-shell.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 7804ef27..907a96e1 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -29,7 +29,10 @@ * Executes a tmux command if a shell command returns true or false. */ -static enum cmd_retval cmd_if_shell_exec(struct cmd *, struct cmdq_item *); +static enum args_parse_type cmd_if_shell_args_parse(struct args *, u_int, + char **); +static enum cmd_retval cmd_if_shell_exec(struct cmd *, + struct cmdq_item *); static void cmd_if_shell_callback(struct job *); static void cmd_if_shell_free(void *); @@ -38,7 +41,7 @@ const struct cmd_entry cmd_if_shell_entry = { .name = "if-shell", .alias = "if", - .args = { "bFt:", 2, 3, NULL }, + .args = { "bFt:", 2, 3, cmd_if_shell_args_parse }, .usage = "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command " "[command]", @@ -56,6 +59,15 @@ struct cmd_if_shell_data { struct cmdq_item *item; }; +static enum args_parse_type +cmd_if_shell_args_parse(__unused struct args *args, u_int idx, + __unused char **cause) +{ + if (idx == 1 || idx == 2) + return (ARGS_PARSE_COMMANDS_OR_STRING); + return (ARGS_PARSE_STRING); +} + static enum cmd_retval cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) { |