summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-choose-tree.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2021-08-27 17:25:56 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2021-08-27 17:25:56 +0000
commit916b1961091211ea4a58e0a54a72053e2fadc855 (patch)
tree790d0f70ac27e17d69a55b11050d43af98c0c534 /usr.bin/tmux/cmd-choose-tree.c
parentb9b52f488ddb6092e0930ae75f736ff92ab99f35 (diff)
Replace %% in command lists (by copying them) for template arguments ,
this means they can be used with {} as well. Also make argument processing from an existing vector preserve commands. GitHub issue 2858.
Diffstat (limited to 'usr.bin/tmux/cmd-choose-tree.c')
-rw-r--r--usr.bin/tmux/cmd-choose-tree.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd-choose-tree.c b/usr.bin/tmux/cmd-choose-tree.c
index 56580010211..e84c87e3d85 100644
--- a/usr.bin/tmux/cmd-choose-tree.c
+++ b/usr.bin/tmux/cmd-choose-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-choose-tree.c,v 1.49 2021/08/21 10:22:38 nicm Exp $ */
+/* $OpenBSD: cmd-choose-tree.c,v 1.50 2021/08/27 17:25:55 nicm Exp $ */
/*
* Copyright (c) 2012 Thomas Adam <thomas@xteddy.org>
@@ -24,13 +24,16 @@
* Enter a mode.
*/
-static enum cmd_retval cmd_choose_tree_exec(struct cmd *, struct cmdq_item *);
+static enum args_parse_type cmd_choose_tree_args_parse(struct args *args,
+ u_int idx, char **cause);
+static enum cmd_retval cmd_choose_tree_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_choose_tree_entry = {
.name = "choose-tree",
.alias = NULL,
- .args = { "F:f:GK:NO:rst:wZ", 0, 1, NULL },
+ .args = { "F:f:GK:NO:rst:wZ", 0, 1, cmd_choose_tree_args_parse },
.usage = "[-GNrswZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
@@ -44,7 +47,7 @@ const struct cmd_entry cmd_choose_client_entry = {
.name = "choose-client",
.alias = NULL,
- .args = { "F:f:K:NO:rt:Z", 0, 1, NULL },
+ .args = { "F:f:K:NO:rt:Z", 0, 1, cmd_choose_tree_args_parse },
.usage = "[-NrZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
@@ -58,7 +61,7 @@ const struct cmd_entry cmd_choose_buffer_entry = {
.name = "choose-buffer",
.alias = NULL,
- .args = { "F:f:K:NO:rt:Z", 0, 1, NULL },
+ .args = { "F:f:K:NO:rt:Z", 0, 1, cmd_choose_tree_args_parse },
.usage = "[-NrZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
@@ -81,6 +84,13 @@ const struct cmd_entry cmd_customize_mode_entry = {
.exec = cmd_choose_tree_exec
};
+static enum args_parse_type
+cmd_choose_tree_args_parse(__unused struct args *args, __unused u_int idx,
+ __unused char **cause)
+{
+ return (ARGS_PARSE_COMMANDS_OR_STRING);
+}
+
static enum cmd_retval
cmd_choose_tree_exec(struct cmd *self, struct cmdq_item *item)
{