aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-06-05 16:34:30 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-06-05 16:34:30 +0000
commitceed5cc9a936840a4e40718e0e30f44e71534c5a (patch)
tree7adc97dbe0a2885fc8f53a0a378eff1b787c7f0c
parent0440d325d9dcef2170f2b7695d06d0ba10e9875d (diff)
downloadrtmux-ceed5cc9a936840a4e40718e0e30f44e71534c5a.tar.gz
rtmux-ceed5cc9a936840a4e40718e0e30f44e71534c5a.tar.bz2
rtmux-ceed5cc9a936840a4e40718e0e30f44e71534c5a.zip
Support the status_replace # replacement sequences in the pipe-pane
command, thanks to Andrea Barisani.
-rw-r--r--cmd-pipe-pane.c9
-rw-r--r--tmux.17
2 files changed, 14 insertions, 2 deletions
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 0d7c3ff6..72903a3d 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -23,6 +23,7 @@
#include <fcntl.h>
#include <paths.h>
#include <string.h>
+#include <time.h>
#include <unistd.h>
#include "tmux.h"
@@ -50,9 +51,14 @@ int
cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
+ struct client *c;
struct window_pane *wp;
+ char *command;
int old_fd, pipe_fd[2], null_fd, mode;
+ if ((c = cmd_find_client(ctx, data->target)) == NULL)
+ return (-1);
+
if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
return (-1);
@@ -106,7 +112,8 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
if (null_fd != STDOUT_FILENO && null_fd != STDERR_FILENO)
close(null_fd);
- execl(_PATH_BSHELL, "sh", "-c", data->arg, (char *) NULL);
+ command = status_replace(c, NULL, data->arg, time(NULL), 0);
+ execl(_PATH_BSHELL, "sh", "-c", command, (char *) NULL);
_exit(1);
default:
/* Parent process. */
diff --git a/tmux.1 b/tmux.1
index 94e60758..43ea6e06 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1124,6 +1124,11 @@ A pane may only be piped to one command at a time, any existing pipe is
closed before
.Ar shell-command
is executed.
+The
+.Ar shell-command
+string may contain the special character sequences supported by the
+.Ic status-left
+command.
If no
.Ar shell-command
is given, the current pipe (if any) is closed.
@@ -1133,7 +1138,7 @@ The
option only opens a new pipe if no previous pipe exists, allowing a pipe to
be toggled with a single key, for example:
.Bd -literal -offset indent
-bind-key C-p pipe-pane -o 'cat >>~/output'
+bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
.Ed
.It Xo Ic previous-window
.Op Fl a