version 1.33, 2017/05/01 12:20:55 |
version 1.34, 2020/04/12 08:36:18 |
|
|
.name = "list-panes", |
.name = "list-panes", |
.alias = "lsp", |
.alias = "lsp", |
|
|
.args = { "asF:t:", 0, 0 }, |
.args = { "asF:f:t:", 0, 0 }, |
.usage = "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE, |
.usage = "[-as] [-F format] [-f filter] " CMD_TARGET_WINDOW_USAGE, |
|
|
.target = { 't', CMD_FIND_WINDOW, 0 }, |
.target = { 't', CMD_FIND_WINDOW, 0 }, |
|
|
|
|
struct window_pane *wp; |
struct window_pane *wp; |
u_int n; |
u_int n; |
struct format_tree *ft; |
struct format_tree *ft; |
const char *template; |
const char *template, *filter; |
char *line; |
char *line, *expanded; |
|
int flag; |
|
|
template = args_get(args, 'F'); |
template = args_get(args, 'F'); |
if (template == NULL) { |
if (template == NULL) { |
|
|
break; |
break; |
} |
} |
} |
} |
|
filter = args_get(args, 'f'); |
|
|
n = 0; |
n = 0; |
TAILQ_FOREACH(wp, &wl->window->panes, entry) { |
TAILQ_FOREACH(wp, &wl->window->panes, entry) { |
|
|
format_add(ft, "line", "%u", n); |
format_add(ft, "line", "%u", n); |
format_defaults(ft, NULL, s, wl, wp); |
format_defaults(ft, NULL, s, wl, wp); |
|
|
line = format_expand(ft, template); |
if (filter != NULL) { |
cmdq_print(item, "%s", line); |
expanded = format_expand(ft, filter); |
free(line); |
flag = format_true(expanded); |
|
free(expanded); |
|
} else |
|
flag = 1; |
|
if (flag) { |
|
line = format_expand(ft, template); |
|
cmdq_print(item, "%s", line); |
|
free(line); |
|
} |
|
|
format_free(ft); |
format_free(ft); |
n++; |
n++; |