version 1.37, 2015/12/11 12:27:36 |
version 1.38, 2015/12/13 14:32:38 |
|
|
"if-shell", "if", |
"if-shell", "if", |
"bFt:", 2, 3, |
"bFt:", 2, 3, |
"[-bF] " CMD_TARGET_PANE_USAGE " shell-command command [command]", |
"[-bF] " CMD_TARGET_PANE_USAGE " shell-command command [command]", |
0, |
CMD_PANE_T|CMD_CANFAIL, |
cmd_if_shell_exec |
cmd_if_shell_exec |
}; |
}; |
|
|
|
|
struct cmd_if_shell_data *cdata; |
struct cmd_if_shell_data *cdata; |
char *shellcmd, *cmd, *cause; |
char *shellcmd, *cmd, *cause; |
struct cmd_list *cmdlist; |
struct cmd_list *cmdlist; |
struct client *c; |
struct session *s = cmdq->state.tflag.s; |
struct session *s = NULL; |
struct winlink *wl = cmdq->state.tflag.wl; |
struct winlink *wl = NULL; |
struct window_pane *wp = cmdq->state.tflag.wp; |
struct window_pane *wp = NULL; |
|
struct format_tree *ft; |
struct format_tree *ft; |
const char *cwd; |
const char *cwd; |
|
|
if (args_has(args, 't')) { |
cwd = wp->cwd; |
wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); |
|
cwd = wp->cwd; |
|
} else { |
|
c = cmd_find_client(cmdq, NULL, 1); |
|
if (c != NULL && c->session != NULL) { |
|
s = c->session; |
|
wl = s->curw; |
|
wp = wl->window->active; |
|
} |
|
if (cmdq->client != NULL && cmdq->client->session == NULL) |
|
cwd = cmdq->client->cwd; |
|
else if (s != NULL) |
|
cwd = s->cwd; |
|
else |
|
cwd = NULL; |
|
} |
|
|
|
|
if (cmdq->client != NULL && cmdq->client->session == NULL) |
|
cwd = cmdq->client->cwd; |
|
else if (s != NULL) |
|
cwd = s->cwd; |
|
else |
|
cwd = NULL; |
ft = format_create(cmdq, 0); |
ft = format_create(cmdq, 0); |
format_defaults(ft, NULL, s, wl, wp); |
format_defaults(ft, NULL, s, wl, wp); |
shellcmd = format_expand(ft, args->argv[0]); |
shellcmd = format_expand(ft, args->argv[0]); |