summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-06-18 09:16:15 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-06-18 09:16:15 +0000
commit2113115cdd554065c760ee2de8bf2790c541edf3 (patch)
tree85ec204efc61b34a58e967163b78ff0221cc738f
parent038e8b770d3ae551e9547a22d595877d237c2891 (diff)
Add -a for kill-session, from Thomas Adam.
-rw-r--r--cmd-kill-session.c20
-rw-r--r--tmux.17
2 files changed, 20 insertions, 7 deletions
diff --git a/cmd-kill-session.c b/cmd-kill-session.c
index 69caef9e..bdc4a71c 100644
--- a/cmd-kill-session.c
+++ b/cmd-kill-session.c
@@ -31,8 +31,8 @@ int cmd_kill_session_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_kill_session_entry = {
"kill-session", NULL,
- "t:", 0, 0,
- CMD_TARGET_SESSION_USAGE,
+ "at:", 0, 0,
+ "[-a] " CMD_TARGET_SESSION_USAGE,
0,
NULL,
NULL,
@@ -43,13 +43,21 @@ int
cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
- struct session *s;
+ struct session *s, *s2, *s3;
if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL)
return (-1);
- server_destroy_session(s);
- session_destroy(s);
-
+ if (args_has(args, 'a')) {
+ RB_FOREACH_SAFE(s2, sessions, &sessions, s3) {
+ if (s != s2) {
+ server_destroy_session(s2);
+ session_destroy(s2);
+ }
+ }
+ } else {
+ server_destroy_session(s);
+ session_destroy(s);
+ }
return (0);
}
diff --git a/tmux.1 b/tmux.1
index 826e1cac..e91046ed 100644
--- a/tmux.1
+++ b/tmux.1
@@ -610,9 +610,14 @@ If it does exist, exit with 0.
Kill the
.Nm
server and clients and destroy all sessions.
-.It Ic kill-session Op Fl t Ar target-session
+.It Ic kill-session
+.Op Fl a
+.Op Fl t Ar target-session
Destroy the given session, closing any windows linked to it and no other
sessions, and detaching all clients attached to it.
+If
+.Fl a
+is given, all sessions but the specified one is killed.
.It Xo Ic list-clients
.Op Fl F Ar format
.Op Fl t Ar target-session