mirror of
https://github.com/tmux/tmux.git
synced 2026-06-20 17:25:57 +00:00
Add -g flag to kill-session to kill all sessions in a group, GitHub
issue 5157 from github at jiku dot jp.
This commit is contained in:
@@ -33,8 +33,8 @@ const struct cmd_entry cmd_kill_session_entry = {
|
|||||||
.name = "kill-session",
|
.name = "kill-session",
|
||||||
.alias = NULL,
|
.alias = NULL,
|
||||||
|
|
||||||
.args = { "aCt:", 0, 0, NULL },
|
.args = { "aCgt:", 0, 0, NULL },
|
||||||
.usage = "[-aC] " CMD_TARGET_SESSION_USAGE,
|
.usage = "[-aCg] " CMD_TARGET_SESSION_USAGE,
|
||||||
|
|
||||||
.target = { 't', CMD_FIND_SESSION, 0 },
|
.target = { 't', CMD_FIND_SESSION, 0 },
|
||||||
|
|
||||||
@@ -48,6 +48,7 @@ cmd_kill_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
struct args *args = cmd_get_args(self);
|
struct args *args = cmd_get_args(self);
|
||||||
struct cmd_find_state *target = cmdq_get_target(item);
|
struct cmd_find_state *target = cmdq_get_target(item);
|
||||||
struct session *s = target->s, *sloop, *stmp;
|
struct session *s = target->s, *sloop, *stmp;
|
||||||
|
struct session_group *sg;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
|
|
||||||
if (args_has(args, 'C')) {
|
if (args_has(args, 'C')) {
|
||||||
@@ -63,6 +64,12 @@ cmd_kill_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
session_destroy(sloop, 1, __func__);
|
session_destroy(sloop, 1, __func__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (args_has(args, 'g') &&
|
||||||
|
(sg = session_group_contains(s)) != NULL) {
|
||||||
|
TAILQ_FOREACH_SAFE(sloop, &sg->sessions, gentry, stmp) {
|
||||||
|
server_destroy_session(sloop);
|
||||||
|
session_destroy(sloop, 1, __func__);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
server_destroy_session(s);
|
server_destroy_session(s);
|
||||||
session_destroy(s, 1, __func__);
|
session_destroy(s, 1, __func__);
|
||||||
|
|||||||
6
tmux.1
6
tmux.1
@@ -1202,7 +1202,7 @@ Kill the
|
|||||||
.Nm
|
.Nm
|
||||||
server and clients and destroy all sessions.
|
server and clients and destroy all sessions.
|
||||||
.It Xo Ic kill\-session
|
.It Xo Ic kill\-session
|
||||||
.Op Fl aC
|
.Op Fl aCg
|
||||||
.Op Fl t Ar target\-session
|
.Op Fl t Ar target\-session
|
||||||
.Xc
|
.Xc
|
||||||
Destroy the given session, closing any windows linked to it and no other
|
Destroy the given session, closing any windows linked to it and no other
|
||||||
@@ -1210,6 +1210,10 @@ sessions, and detaching all clients attached to it.
|
|||||||
If
|
If
|
||||||
.Fl a
|
.Fl a
|
||||||
is given, all sessions but the specified one is killed.
|
is given, all sessions but the specified one is killed.
|
||||||
|
If
|
||||||
|
.Fl g
|
||||||
|
is given and the session is in a session group, all sessions in the group are
|
||||||
|
killed.
|
||||||
The
|
The
|
||||||
.Fl C
|
.Fl C
|
||||||
flag clears alerts (bell, activity, or silence) in all windows linked to the
|
flag clears alerts (bell, activity, or silence) in all windows linked to the
|
||||||
|
|||||||
Reference in New Issue
Block a user